return result;
}
-pub static RUNNING: &'static str = " Running";
-pub static COMPILING: &'static str = " Compiling";
-pub static ERROR: &'static str = "error:";
-pub static DOCUMENTING: &'static str = " Documenting";
-pub static FRESH: &'static str = " Fresh";
-pub static UPDATING: &'static str = " Updating";
pub static ADDING: &'static str = " Adding";
pub static REMOVING: &'static str = " Removing";
pub static DOCTEST: &'static str = " Doc-tests";
-use support::{project, execs, main_file, basic_bin_manifest, ERROR};
+use support::{project, execs, main_file, basic_bin_manifest};
use hamcrest::{assert_that};
fn setup() {}
.arg("--manifest-path").arg(manifest_path_argument)
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("{error} the manifest-path must be a path \
- to a Cargo.toml file",
- error = ERROR)));
+ .with_stderr(&format!("[ERROR] the manifest-path must be a path \
+ to a Cargo.toml file")));
}
#[allow(deprecated)] // connect => join in 1.3
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
.with_stderr(
- format!("{error} manifest path `{}` does not exist",
- expected_path, error = ERROR)
+ format!("[ERROR] manifest path `{}` does not exist",
+ expected_path)
));
}
use cargo_process;
use support::paths;
-use support::{execs, project, mkdir_recursive, ProjectBuilder, ERROR};
+use support::{execs, project, mkdir_recursive, ProjectBuilder};
use hamcrest::{assert_that};
fn setup() {
assert_that(pr,
execs().with_status(101)
- .with_stderr(&format!("{error} no such subcommand
+ .with_stderr(&format!("[ERROR] no such subcommand
<tab>Did you mean `build`?
-",
-error = ERROR)));
+")));
});
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
assert_that(pr,
execs().with_status(101)
- .with_stderr(&format!("{error} no such subcommand
-",
-error = ERROR)));
+ .with_stderr(&format!("[ERROR] no such subcommand
+")));
});
test!(override_cargo_home {
use std::str;
use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
-use support::{COMPILING, FRESH, RUNNING};
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
assert_that(p.cargo("bench"),
execs().with_stdout(&format!("\
-{} foo v0.5.0 ({})
-{} target[..]release[..]foo-[..]
+[COMPILING] foo v0.5.0 ({})
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-",
- COMPILING, p.url(),
- RUNNING)));
+", p.url())));
});
test!(bench_tarname {
#[bench] fn run2(_ben: &mut test::Bencher) { }"#);
let expected_stdout = format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]release[..]bin2[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]release[..]bin2[..]
running 1 test
test run2 ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING,
- running = RUNNING,
dir = prj.url());
assert_that(prj.cargo_process("bench").arg("--bench").arg("bin2"),
assert_that(p.cargo_process("bench").arg("-v").arg("hello"),
execs().with_stdout(&format!("\
-{compiling} foo v0.5.0 ({url})
-{running} `rustc src[..]foo.rs [..]`
-{running} `[..]target[..]release[..]foo-[..] hello --bench`
+[COMPILING] foo v0.5.0 ({url})
+[RUNNING] `rustc src[..]foo.rs [..]`
+[RUNNING] `[..]target[..]release[..]foo-[..] hello --bench`
running 1 test
test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-",
- compiling = COMPILING, url = p.url(), running = RUNNING)));
+", url = p.url())));
});
test!(many_similar_names {
assert_that(p.cargo("bench"),
execs().with_stdout_contains(&format!("\
-{} foo v0.5.0 ({})
-{} target[..]release[..]foo-[..]
+[COMPILING] foo v0.5.0 ({})
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test bench_hello ... ",
- COMPILING, p.url(), RUNNING))
+ p.url()))
.with_stderr_contains("\
thread '<main>' panicked at 'assertion failed: \
`(left == right)` (left: \
assert_that(p.cargo_process("bench"),
execs().with_stdout(&format!("\
-{} foo v0.0.1 ({})
-{running} target[..]release[..]baz-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]release[..]baz-[..]
running 1 test
test bin_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test lib_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- COMPILING, p.url(), running = RUNNING)))
+ p.url())))
});
test!(bench_with_deep_lib_dep {
assert_that(p.cargo_process("bench"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{compiling} bar v0.0.1 ({dir})
-{running} target[..]
+[COMPILING] foo v0.0.1 ([..])
+[COMPILING] bar v0.0.1 ({dir})
+[RUNNING] target[..]
running 1 test
test bar_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo_process("bench"),
execs().with_stdout(&format!("\
-{} foo v0.0.1 ({})
-{running} target[..]release[..]bench-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]release[..]bench-[..]
running 1 test
test external_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test internal_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- COMPILING, p.url(), running = RUNNING)))
+ p.url())))
});
test!(external_bench_implicit {
assert_that(p.cargo_process("bench"),
execs().with_stdout(&format!("\
-{} foo v0.0.1 ({})
-{running} target[..]release[..]external-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]release[..]external-[..]
running 1 test
test external_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test internal_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- COMPILING, p.url(), running = RUNNING)))
+ p.url())))
});
test!(dont_run_examples {
assert_that(p.cargo_process("bench").arg("bar"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]release[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test bar ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
assert_that(p.cargo("bench").arg("foo"),
execs().with_status(0)
.with_stdout(&format!("\
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-", running = RUNNING)));
+")));
});
// Regression test for running cargo-bench twice with
assert_that(p.cargo_process("bench"),
execs().with_stdout(&format!("\
-{} foo v0.0.1 ({})
-{running} target[..]release[..]foo-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test [..] ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test [..] ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- COMPILING, p.url(), running = RUNNING)))
+ p.url())))
});
test!(lib_with_standard_name {
assert_that(p.cargo_process("bench"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
-{running} target[..]release[..]bench-[..]
+[COMPILING] syntax v0.0.1 ({dir})
+[RUNNING] target[..]release[..]bench-[..]
running 1 test
test bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]syntax-[..]
+[RUNNING] target[..]release[..]syntax-[..]
running 1 test
test foo_bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo_process("bench"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
-{running} target[..]release[..]syntax-[..]
+[COMPILING] syntax v0.0.1 ({dir})
+[RUNNING] target[..]release[..]syntax-[..]
running 1 test
test bench ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo_process("bench").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{running} [..] -C opt-level=3 [..]
-{compiling} foo v0.0.1 ({dir})
-{running} [..] -C opt-level=3 [..]
-{running} [..] -C opt-level=3 [..]
-{running} [..] -C opt-level=3 [..]
-{running} [..]target[..]release[..]bench-[..]
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[RUNNING] [..] -C opt-level=3 [..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] [..]target[..]release[..]bench-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} [..]target[..]release[..]foo-[..]
+[RUNNING] [..]target[..]release[..]foo-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("bench").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{fresh} bar v0.0.1 ({dir}/bar)
-{fresh} foo v0.0.1 ({dir})
-{running} [..]target[..]release[..]bench-[..]
+[FRESH] bar v0.0.1 ({dir}/bar)
+[FRESH] foo v0.0.1 ({dir})
+[RUNNING] [..]target[..]release[..]bench-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} [..]target[..]release[..]foo-[..]
+[RUNNING] [..]target[..]release[..]foo-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- fresh = FRESH, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo_process("bench"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]release[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
assert_that(p.cargo("bench"),
execs().with_status(0)
.with_stdout(&format!("\
-{running} target[..]release[..]foo-[..]
+[RUNNING] target[..]release[..]foo-[..]
running 1 test
test foo ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-",
- running = RUNNING)));
+")));
});
test!(bench_with_examples {
assert_that(p.cargo_process("bench").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} testbench v6.6.6 ({url})
-{running} `rustc [..]`
-{running} `rustc [..]`
-{running} `rustc [..]`
-{running} `{dir}[..]target[..]release[..]testb1-[..] --bench`
+[COMPILING] testbench v6.6.6 ({url})
+[RUNNING] `rustc [..]`
+[RUNNING] `rustc [..]`
+[RUNNING] `rustc [..]`
+[RUNNING] `{dir}[..]target[..]release[..]testb1-[..] --bench`
running 1 test
test bench_bench2 ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} `{dir}[..]target[..]release[..]testbench-[..] --bench`
+[RUNNING] `{dir}[..]target[..]release[..]testbench-[..] --bench`
running 1 test
test bench_bench1 ... bench: [..] 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
- compiling = COMPILING,
- running = RUNNING,
dir = p.root().display(),
url = p.url())));
});
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.1.0 ([..])
-{running} target[..]debug[..]b-[..]
+[COMPILING] foo v0.1.0 ([..])
+[RUNNING] target[..]debug[..]b-[..]
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING)));
+")));
});
test!(test_bench_no_run {
assert_that(p.cargo_process("bench").arg("--no-run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.1.0 ([..])
-", compiling = COMPILING)));
+[COMPILING] foo v0.1.0 ([..])
+")));
});
test!(test_bench_multiple_packages {
assert_that(p.cargo_process("bench").arg("-p").arg("bar").arg("-p").arg("baz"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} target[..]release[..]bbaz-[..]
+[RUNNING] target[..]release[..]bbaz-[..]
running 1 test
test bench_baz ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-", running = RUNNING))
+"))
.with_stdout_contains(&format!("\
-{running} target[..]release[..]bbar-[..]
+[RUNNING] target[..]release[..]bbar-[..]
running 1 test
test bench_bar ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-", running = RUNNING)));
+")));
});
use bufstream::BufStream;
use git2;
-use support::{project, execs, UPDATING, ERROR};
+use support::{project, execs};
use support::paths;
use hamcrest::assert_that;
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stdout(&format!("\
-{updating} git repository `http://{addr}/foo/bar`
+[UPDATING] git repository `http://{addr}/foo/bar`
",
- updating = UPDATING,
addr = addr,
))
.with_stderr(&format!("\
-{error} Unable to update http://{addr}/foo/bar
+[ERROR] Unable to update http://{addr}/foo/bar
Caused by:
failed to clone into: [..]
To learn more, run the command again with --verbose.
",
- addr = addr,
- error = ERROR)));
+ addr = addr)));
t.join().ok().unwrap();
});
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101).with_stdout(&format!("\
-{updating} git repository `https://{addr}/foo/bar`
+[UPDATING] git repository `https://{addr}/foo/bar`
",
- updating = UPDATING,
addr = addr,
))
.with_stderr_contains(&format!("\
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101).with_stdout(&format!("\
-{updating} git repository `ssh://{addr}/foo/bar`
+[UPDATING] git repository `ssh://{addr}/foo/bar`
",
- updating = UPDATING,
addr = addr,
))
.with_stderr_contains("\
use std::path::MAIN_SEPARATOR as SEP;
use support::{basic_bin_manifest, execs, project, ProjectBuilder};
-use support::{COMPILING, RUNNING, ERROR};
use hamcrest::{assert_that};
fn setup() {
fn verbose_output_for_lib(p: &ProjectBuilder) -> String {
format!("\
-{compiling} {name} v{version} ({url})
-{running} `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \
+[COMPILING] {name} v{version} ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, compiling = COMPILING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url(),
name = "foo", version = "0.0.1")
}
assert_that(p.cargo_process("build").arg("--lib"),
execs().with_status(101)
- .with_stderr(&format!("{error} no library targets found", error = ERROR)));
+ .with_stderr(&format!("[ERROR] no library targets found")));
});
test!(build_with_relative_cargo_home_path {
use cargo::util::{Cfg, CfgExpr};
use hamcrest::assert_that;
-use support::{project, execs, COMPILING, UPDATING, DOWNLOADING, ERROR};
+use support::{project, execs, DOWNLOADING};
use support::registry::Package;
macro_rules! c {
.file("b/src/lib.rs", "");
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.0.1 ([..])
-", compiling = COMPILING)));
+[COMPILING] a v0.0.1 ([..])
+")));
});
test!(works_through_the_registry {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry [..]
+[UPDATING] registry [..]
{downloading} [..]
{downloading} [..]
-{compiling} foo v0.1.0 ([..])
-{compiling} bar v0.1.0 ([..])
-{compiling} a v0.0.1 ([..])
-", compiling = COMPILING, updating = UPDATING, downloading = DOWNLOADING)));
+[COMPILING] foo v0.1.0 ([..])
+[COMPILING] bar v0.1.0 ([..])
+[COMPILING] a v0.0.1 ([..])
+", downloading = DOWNLOADING)));
});
test!(bad_target_spec {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
failed to parse `4` as a cfg expression
Caused by:
unexpected character in cfg `4`, [..]
-",
-error = ERROR)));
+")));
});
test!(bad_target_spec2 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
failed to parse `foo =` as a cfg expression
Caused by:
expected a string, found nothing
-",
-error = ERROR)));
+")));
});
test!(multiple_match_ok {
use std::env;
use support::{git, project, execs, main_file, basic_bin_manifest};
-use support::{COMPILING, RUNNING};
use support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
execs().with_status(0));
assert_that(p.cargo("build").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-", compiling = COMPILING)));
+[COMPILING] foo v0.0.1 ([..])
+")));
});
test!(build_script {
execs().with_status(0));
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} `rustc build.rs [..]`
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]main.rs [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc build.rs [..]`
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]main.rs [..]`
+")));
});
test!(clean_git {
use tempdir::TempDir;
use support::{project, execs, main_file, basic_bin_manifest};
-use support::{COMPILING, RUNNING, ProjectBuilder, ERROR};
+use support::{ProjectBuilder};
use hamcrest::{assert_that, existing_file, is_not};
use support::paths::{CargoPathExt,root};
use cargo::util::process;
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
no `package` or `project` section found.
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_with_invalid_manifest2 {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
could not parse input as TOML
Cargo.toml:3:19-3:20 expected a value
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_with_invalid_manifest3 {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
could not parse input as TOML\n\
-src[..]Cargo.toml:1:5-1:6 expected a value\n\n",
-error = ERROR)))
+src[..]Cargo.toml:1:5-1:6 expected a value\n\n")))
});
test!(cargo_compile_with_invalid_version {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
cannot parse '1.0' as a semver for the key `project.version`
-",
-error = ERROR)))
+")))
});
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
package name cannot be an empty string.
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_with_invalid_bin_target_name {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
binary target names cannot be empty.
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_with_forbidden_bin_target_name {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
the binary target name `build` is forbidden
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_with_invalid_lib_target_name {
execs()
.with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
library target names cannot be empty.
-",
-error = ERROR)))
+")))
});
test!(cargo_compile_without_manifest {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} could not find `Cargo.toml` in `[..]` or any parent directory
-",
-error = ERROR)));
+[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory
+")));
});
test!(cargo_compile_with_invalid_code {
^~~~~~~
")
.with_stderr_contains(format!("\
-{error} Could not compile `foo`.
+[ERROR] Could not compile `foo`.
-To learn more, run the command again with --verbose.\n", error = ERROR)));
+To learn more, run the command again with --verbose.\n")));
assert_that(&p.root().join("Cargo.lock"), existing_file());
});
assert_that(p.cargo_process("build"),
execs()
- .with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url()))
+ .with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url()))
.with_stderr("\
[..]warning: function is never used: `dead`[..]
[..]fn dead() {}
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!(
-r#"{error} no matching package named `notquitebar` found (required by `foo`)
+r#"[ERROR] no matching package named `notquitebar` found (required by `foo`)
location searched: {proj_dir}/bar
version required: *
-"#, error = ERROR, proj_dir = p.url())));
+"#, proj_dir = p.url())));
});
test!(cargo_compile_with_filename{
assert_that(p.cargo_process("build").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no bin target named `bin.rs`", error = ERROR)));
+[ERROR] no bin target named `bin.rs`")));
assert_that(p.cargo_process("build").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no bin target named `a.rs`
+[ERROR] no bin target named `a.rs`
-Did you mean `a`?", error = ERROR)));
+Did you mean `a`?")));
assert_that(p.cargo_process("build").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no example target named `example.rs`", error = ERROR)));
+[ERROR] no example target named `example.rs`")));
assert_that(p.cargo_process("build").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no example target named `a.rs`
+[ERROR] no example target named `a.rs`
-Did you mean `a`?", error = ERROR)));
+Did you mean `a`?")));
});
test!(compile_path_dep_then_change_version {
assert_that(p.cargo("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `bar` found (required by `foo`)
+[ERROR] no matching package named `bar` found (required by `foo`)
location searched: [..]
version required: = 0.0.1
versions found: 0.0.2
consider running `cargo update` to update a path dependency's locked version
-",
-error = ERROR)));
+")));
});
test!(ignores_carriage_return_in_lockfile {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} cyclic package dependency: package `test v0.0.0 ([..])` depends on itself
-",
-error = ERROR)));
+[ERROR] cyclic package dependency: package `test v0.0.0 ([..])` depends on itself
+")));
});
test!(ignore_broken_symlinks {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]Cargo.toml`
+[ERROR] failed to parse manifest at `[..]Cargo.toml`
Caused by:
no targets specified in the manifest
- either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n",
-error = ERROR)));
+ either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n")));
});
test!(lto_build {
.file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} test v0.0.0 ({url})
-{running} `rustc src[..]main.rs --crate-name test --crate-type bin \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src[..]main.rs --crate-name test --crate-type bin \
-C opt-level=3 \
-C lto \
--out-dir {dir}[..]target[..]release \
-L dependency={dir}[..]target[..]release \
-L dependency={dir}[..]target[..]release[..]deps`
",
-running = RUNNING, compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
)));
.file("src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} test v0.0.0 ({url})
-{running} `rustc src[..]lib.rs --crate-name test --crate-type lib -g \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src[..]lib.rs --crate-name test --crate-type lib -g \
--out-dir {dir}[..]target[..]debug \
--emit=dep-info,link \
-L dependency={dir}[..]target[..]debug \
-L dependency={dir}[..]target[..]debug[..]deps`
",
-running = RUNNING, compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
)));
.file("src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} test v0.0.0 ({url})
-{running} `rustc src[..]lib.rs --crate-name test --crate-type lib \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src[..]lib.rs --crate-name test --crate-type lib \
-C opt-level=3 \
--out-dir {dir}[..]target[..]release \
--emit=dep-info,link \
-L dependency={dir}[..]target[..]release \
-L dependency={dir}[..]target[..]release[..]deps`
",
-running = RUNNING, compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
)));
.file("foo/src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url}/foo)
-{running} `rustc foo[..]src[..]lib.rs --crate-name foo \
+[COMPILING] foo v0.0.0 ({url}/foo)
+[RUNNING] `rustc foo[..]src[..]lib.rs --crate-name foo \
--crate-type dylib --crate-type rlib -C prefer-dynamic \
-C opt-level=3 \
-C metadata=[..] \
--emit=dep-info,link \
-L dependency={dir}[..]target[..]release[..]deps \
-L dependency={dir}[..]target[..]release[..]deps`
-{compiling} test v0.0.0 ({url})
-{running} `rustc src[..]lib.rs --crate-name test --crate-type lib \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src[..]lib.rs --crate-name test --crate-type lib \
-C opt-level=3 \
--out-dir {dir}[..]target[..]release \
--emit=dep-info,link \
{prefix}foo-[..]{suffix} \
--extern foo={dir}[..]target[..]release[..]deps[..]libfoo-[..].rlib`
",
- running = RUNNING,
- compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
prefix = env::consts::DLL_PREFIX,
assert_that(p.cargo_process("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
+[COMPILING] syntax v0.0.1 ({dir})
",
- compiling = COMPILING,
dir = p.url())));
});
assert_that(foo.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url})
-", compiling = COMPILING, url = foo.url())));
+[COMPILING] foo v0.0.0 ({url})
+", url = foo.url())));
// Smoke test to make sure it doesn't compile again
println!("first pass");
assert_that(foo.cargo("build").env("FIRST", "1"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url})
-", compiling = COMPILING, url = foo.url())));
+[COMPILING] foo v0.0.0 ({url})
+", url = foo.url())));
File::create(&foo.root().join("src/bar.rs")).unwrap();
assert_that(foo.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url})
-", compiling = COMPILING, url = foo.url())));
+[COMPILING] foo v0.0.0 ({url})
+", url = foo.url())));
});
test!(dep_no_libs {
"#);
assert_that(foo.cargo_process("build").arg("-v"),
execs().with_status(101).with_stderr(&format!("\
-{error} Couldn't load Cargo configuration
+[ERROR] Couldn't load Cargo configuration
Caused by:
could not parse TOML configuration in `[..]`
could not parse input as TOML
[..].cargo[..]config:2:20-2:21 expected `=`, but found `i`
-",
-error = ERROR)));
+")));
});
test!(cargo_platform_specific_dependency {
[..] extern crate bbbbb; [..]
[..]
error: aborting due to previous error
-{error} Could not compile `foo`.
+[ERROR] Could not compile `foo`.
Caused by:
[..]
-",
-error = ERROR)));
+")));
});
test!(cyclic_deps_rejected {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} cyclic package dependency: package `foo v0.0.1 ([..])` depends on itself
-",
-error = ERROR)));
+[ERROR] cyclic package dependency: package `foo v0.0.1 ([..])` depends on itself
+")));
});
test!(predictable_filenames {
.env("RUSTC", "rustc-that-does-not-exist").arg("-v"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} Could not execute process `rustc-that-does-not-exist -vV` ([..])
+[ERROR] Could not execute process `rustc-that-does-not-exist -vV` ([..])
Caused by:
[..]
-",
-error = ERROR)));
+")));
assert_that(&p.bin("a"), is_not(existing_file()));
});
assert_that(p.cargo_process("build").arg("-p").arg("notAValidDep"),
execs().with_status(101).with_stderr(&format!(
- "{error} could not find package matching spec `notAValidDep`", error = ERROR)));
+ "[ERROR] could not find package matching spec `notAValidDep`")));
assert_that(p.cargo_process("build").arg("-p").arg("d1").arg("-p").arg("notAValidDep"),
execs().with_status(101).with_stderr(&format!(
- "{error} could not find package matching spec `notAValidDep`", error = ERROR)));
+ "[ERROR] could not find package matching spec `notAValidDep`")));
});
use std::io::prelude::*;
use support::{project, execs};
-use support::{COMPILING, RUNNING, DOCTEST, FRESH, DOCUMENTING, ERROR};
+use support::{DOCTEST};
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file, existing_dir};
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 ({url})
-{running} `rustc build.rs --crate-name build_script_build --crate-type bin [..]`
-{running} `[..]build-script-build[..]`
+[COMPILING] foo v0.5.0 ({url})
+[RUNNING] `rustc build.rs --crate-name build_script_build --crate-type bin [..]`
+[RUNNING] `[..]build-script-build[..]`
",
-url = p.url(), compiling = COMPILING, running = RUNNING))
+url = p.url()))
.with_stderr(&format!("\
-{error} failed to run custom build command for `foo v0.5.0 ({})`
+[ERROR] failed to run custom build command for `foo v0.5.0 ({})`
Process didn't exit successfully: `[..]build[..]build-script-build[..]` \
(exit code: 101)",
-p.url(), error = ERROR)));
+p.url())));
});
test!(custom_build_env_vars {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \
+[ERROR] Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \
`-aaa -bbb`",
-p.url(), error = ERROR)));
+p.url())));
});
/*
assert_that(p.cargo_process("build").arg("--verbose"),
execs().with_status(101)
.with_stdout(&format!("\
-{compiling} bar v0.5.0 ({url})
-{running} `rustc {dir}{sep}src{sep}lib.rs --crate-name test --crate-type lib -g \
+[COMPILING] bar v0.5.0 ({url})
+[RUNNING] `rustc {dir}{sep}src{sep}lib.rs --crate-name test --crate-type lib -g \
-C metadata=[..] \
-C extra-filename=-[..] \
--out-dir {dir}{sep}target \
--emit=dep-info,link \
-L {dir}{sep}target \
-L {dir}{sep}target{sep}deps`
-",
-running = RUNNING, compiling = COMPILING, sep = path::SEP,
+", sep = path::SEP,
dir = p.root().display(),
url = p.url(),
)));
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \
+[ERROR] package `foo v0.5.0 (file://[..])` specifies that it links to `a` but does \
not have a custom build script
-",
- error = ERROR)));
+")));
});
test!(links_duplicates {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} native library `a` is being linked to by more than one package, and can only be \
+[ERROR] native library `a` is being linked to by more than one package, and can only be \
linked to by one package
[..] v0.5.0 (file://[..])
[..] v0.5.0 (file://[..])
-",
- error = ERROR)));
+")));
});
test!(overrides_and_links {
[..]
[..]
[..]
-{running} `rustc [..] --crate-name foo [..] -L foo -L bar[..]`
-", running = RUNNING)));
+[RUNNING] `rustc [..] --crate-name foo [..] -L foo -L bar[..]`
+")));
});
test!(unused_overrides {
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `[..]build-script-build[..]`
-{running} `rustc [..] --crate-name foo [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc [..] --crate-name foo [..]`
+")));
});
test!(rebuild_continues_to_pass_env_vars {
assert_that(p.cargo("test").arg("-vj1"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `[..]build-script-build[..]`
-{running} `rustc [..] --crate-name foo [..]`
-{running} `rustc [..] --crate-name foo [..]`
-{running} `[..]foo-[..][..]`
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc [..] --crate-name foo [..]`
+[RUNNING] `rustc [..] --crate-name foo [..]`
+[RUNNING] `[..]foo-[..][..]`
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
{doctest} foo
-{running} `rustdoc --test [..]`
+[RUNNING] `rustdoc --test [..]`
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)));
+", doctest = DOCTEST)));
println!("doc");
assert_that(p.cargo("doc").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{documenting} foo v0.5.0 (file://[..])
-{running} `rustdoc [..]`
-", documenting = DOCUMENTING, running = RUNNING)));
+[DOCUMENTING] foo v0.5.0 (file://[..])
+[RUNNING] `rustdoc [..]`
+")));
File::create(&p.root().join("src/main.rs")).unwrap()
.write_all(b"fn main() {}").unwrap();
assert_that(p.cargo("run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `target[..]foo[..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `target[..]foo[..]`
+")));
});
test!(propagation_of_l_flags {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc [..] --crate-name foo [..] -L bar -L foo`
-", compiling = COMPILING, running = RUNNING)));
+[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
+")));
});
test!(propagation_of_l_flags_new {
assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc [..] --crate-name foo [..] -L bar -L foo`
-", compiling = COMPILING, running = RUNNING)));
+[RUNNING] `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc [..] --crate-name foo [..] -L bar -L foo`
+")));
});
test!(build_deps_simple {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} a v0.5.0 (file://[..])
-{running} `rustc [..] --crate-name a [..]`
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc build.rs [..] --extern a=[..]`
-{running} `[..]foo-[..]build-script-build[..]`
-{running} `rustc [..] --crate-name foo [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] a v0.5.0 (file://[..])
+[RUNNING] `rustc [..] --crate-name a [..]`
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc build.rs [..] --extern a=[..]`
+[RUNNING] `[..]foo-[..]build-script-build[..]`
+[RUNNING] `rustc [..] --crate-name foo [..]`
+")));
});
test!(build_deps_not_for_normal {
[..]lib.rs[..] extern crate aaaaa;
[..] ^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
-{error} Could not compile `foo`.
+[ERROR] Could not compile `foo`.
Caused by:
Process didn't exit successfully: [..]
-",
- error = ERROR)));
+")));
});
test!(build_cmd_with_a_build_cmd {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} b v0.5.0 (file://[..])
-{running} `rustc [..] --crate-name b [..]`
-{compiling} a v0.5.0 (file://[..])
-{running} `rustc a[..]build.rs [..] --extern b=[..]`
-{running} `[..]a-[..]build-script-build[..]`
-{running} `rustc [..]lib.rs --crate-name a --crate-type lib -g \
+[COMPILING] b v0.5.0 (file://[..])
+[RUNNING] `rustc [..] --crate-name b [..]`
+[COMPILING] a v0.5.0 (file://[..])
+[RUNNING] `rustc a[..]build.rs [..] --extern b=[..]`
+[RUNNING] `[..]a-[..]build-script-build[..]`
+[RUNNING] `rustc [..]lib.rs --crate-name a --crate-type lib -g \
-C metadata=[..] -C extra-filename=-[..] \
--out-dir [..]target[..]deps --emit=dep-info,link \
-L [..]target[..]deps -L [..]target[..]deps`
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc build.rs --crate-name build_script_build --crate-type bin \
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc build.rs --crate-name build_script_build --crate-type bin \
-g \
--out-dir [..]build[..]foo-[..] --emit=dep-info,link \
-L [..]target[..]debug -L [..]target[..]deps \
--extern a=[..]liba-[..].rlib`
-{running} `[..]foo-[..]build-script-build[..]`
-{running} `rustc [..]lib.rs --crate-name foo --crate-type lib -g \
+[RUNNING] `[..]foo-[..]build-script-build[..]`
+[RUNNING] `rustc [..]lib.rs --crate-name foo --crate-type lib -g \
--out-dir [..]target[..]debug --emit=dep-info,link \
-L [..]target[..]debug -L [..]target[..]deps`
-", compiling = COMPILING, running = RUNNING)));
+")));
});
test!(out_dir_is_preserved {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc build.rs [..]`
-{running} `[..]foo-[..]build-script-build[..]`
-{running} `rustc [..] --crate-name foo [..] -L foo -l static=foo`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc build.rs [..]`
+[RUNNING] `[..]foo-[..]build-script-build[..]`
+[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
+")));
});
test!(output_separate_lines_new {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `rustc build.rs [..]`
-{running} `[..]foo-[..]build-script-build[..]`
-{running} `rustc [..] --crate-name foo [..] -L foo -l static=foo`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `rustc build.rs [..]`
+[RUNNING] `[..]foo-[..]build-script-build[..]`
+[RUNNING] `rustc [..] --crate-name foo [..] -L foo -l static=foo`
+")));
});
#[cfg(not(windows))] // FIXME(#867)
assert_that(p.cargo_process("run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
-{running} `target[..]foo`
+[COMPILING] foo v0.5.0 (file://[..])
+[RUNNING] `target[..]foo`
Hello, World!
-", compiling = COMPILING, running = RUNNING)));
+")));
assert_that(p.cargo_process("test"),
execs().with_status(0));
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
no targets specified in the manifest
- either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present",
- error = ERROR)));
+ either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present")));
});
test!(shared_dep_with_a_build_script {
"#);
assert_that(p.cargo_process("test").arg("-v"),
execs().with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} [..] build.rs [..]
-{running} [..]build-script-build[..]
-{running} [..] --cfg foo[..]
-{running} [..] --cfg foo[..]
-{running} [..] --cfg foo[..]
-{running} [..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] [..] build.rs [..]
+[RUNNING] [..]build-script-build[..]
+[RUNNING] [..] --cfg foo[..]
+[RUNNING] [..] --cfg foo[..]
+[RUNNING] [..] --cfg foo[..]
+[RUNNING] [..]foo-[..]
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} [..]test-[..]
+[RUNNING] [..]test-[..]
running 1 test
test test_bar ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
{doctest} foo
-{running} [..] --cfg foo[..]
+[RUNNING] [..] --cfg foo[..]
running 1 test
test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-",
-compiling = COMPILING, dir = p.url(), running = RUNNING, doctest = DOCTEST)));
+", dir = p.url(), doctest = DOCTEST)));
});
test!(cfg_doc {
"#);
assert_that(p.cargo_process("test").arg("-v"),
execs().with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `[..]`
-{running} `[..]`
-{running} `[..]`
-{running} [..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `[..]`
+[RUNNING] `[..]`
+[RUNNING] `[..]`
+[RUNNING] [..]foo-[..]
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} [..]test-[..]
+[RUNNING] [..]test-[..]
running 1 test
test test_bar ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
{doctest} foo
-{running} [..] --cfg foo[..]
+[RUNNING] [..] --cfg foo[..]
running 1 test
test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-",
-compiling = COMPILING, dir = p.url(), running = RUNNING, doctest = DOCTEST)));
+", dir = p.url(), doctest = DOCTEST)));
});
test!(cfg_override_doc {
assert_that(p.cargo_process("test").arg("-v").arg("--test=foo"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.5.0 ([..]
-{running} `rustc a[..]build.rs [..]`
-{running} `[..]build-script-build[..]`
-{running} `rustc a[..]src[..]lib.rs [..] -L test[..]`
-{compiling} b v0.5.0 ([..]
-{running} `rustc b[..]src[..]lib.rs [..] -L test[..]`
-{compiling} foo v0.5.0 ([..]
-{running} `rustc src[..]lib.rs [..] -L test[..]`
-{running} `rustc tests[..]foo.rs [..] -L test[..]`
-{running} `[..]foo-[..]`
+[COMPILING] a v0.5.0 ([..]
+[RUNNING] `rustc a[..]build.rs [..]`
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc a[..]src[..]lib.rs [..] -L test[..]`
+[COMPILING] b v0.5.0 ([..]
+[RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]`
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc src[..]lib.rs [..] -L test[..]`
+[RUNNING] `rustc tests[..]foo.rs [..] -L test[..]`
+[RUNNING] `[..]foo-[..]`
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING)));
+")));
assert_that(p.cargo("test").arg("-v").arg("-pb").arg("--lib"),
execs().with_status(0).with_stdout(&format!("\
-{fresh} a v0.5.0 ([..]
-{compiling} b v0.5.0 ([..]
-{running} `rustc b[..]src[..]lib.rs [..] -L test[..]`
-{running} `[..]b-[..]`
+[FRESH] a v0.5.0 ([..]
+[COMPILING] b v0.5.0 ([..]
+[RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]`
+[RUNNING] `[..]b-[..]`
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, fresh = FRESH)));
+")));
});
test!(diamond_passes_args_only_once {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} c v0.5.0 ([..]
-{running} `rustc [..]`
-{running} `[..]`
-{running} `rustc [..]`
-{compiling} b v0.5.0 ([..]
-{running} `rustc [..]`
-{compiling} a v0.5.0 ([..]
-{running} `rustc [..]`
-{compiling} foo v0.5.0 ([..]
-{running} `[..]rlib -L native=test`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] c v0.5.0 ([..]
+[RUNNING] `rustc [..]`
+[RUNNING] `[..]`
+[RUNNING] `rustc [..]`
+[COMPILING] b v0.5.0 ([..]
+[RUNNING] `rustc [..]`
+[COMPILING] a v0.5.0 ([..]
+[RUNNING] `rustc [..]`
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `[..]rlib -L native=test`
+")));
});
test!(adding_an_override_invalidates {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.5.0 ([..]
-{running} `rustc [..]`
-{running} `[..]`
-{running} `rustc [..] -L native=foo`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc [..]`
+[RUNNING] `[..]`
+[RUNNING] `rustc [..] -L native=foo`
+")));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo]
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.5.0 ([..]
-{running} `rustc [..] -L native=bar`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc [..] -L native=bar`
+")));
});
test!(changing_an_override_invalidates {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.5.0 ([..]
-{running} `rustc [..] -L native=foo`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc [..] -L native=foo`
+")));
File::create(p.root().join(".cargo/config")).unwrap().write_all(format!("
[target.{}.foo]
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.5.0 ([..]
-{running} `rustc [..] -L native=bar`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc [..] -L native=bar`
+")));
});
test!(rebuild_only_on_explicit_paths {
println!("run without");
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.5.0 ([..])
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]lib.rs [..]`
-", running = RUNNING, compiling = COMPILING)));
+[COMPILING] a v0.5.0 ([..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]lib.rs [..]`
+")));
::sleep_ms(1000);
File::create(p.root().join("foo")).unwrap();
println!("run with");
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.5.0 ([..])
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]lib.rs [..]`
-", running = RUNNING, compiling = COMPILING)));
+[COMPILING] a v0.5.0 ([..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]lib.rs [..]`
+")));
println!("run with2");
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{fresh} a v0.5.0 ([..])
-", fresh = FRESH)));
+[FRESH] a v0.5.0 ([..])
+")));
::sleep_ms(1000);
File::create(p.root().join("baz")).unwrap();
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{fresh} a v0.5.0 ([..])
-", fresh = FRESH)));
+[FRESH] a v0.5.0 ([..])
+")));
// but changing dependent files does
println!("run foo change");
File::create(p.root().join("foo")).unwrap();
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.5.0 ([..])
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]lib.rs [..]`
-", running = RUNNING, compiling = COMPILING)));
+[COMPILING] a v0.5.0 ([..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]lib.rs [..]`
+")));
// .. as does deleting a file
println!("run foo delete");
fs::remove_file(p.root().join("bar")).unwrap();
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.5.0 ([..])
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]lib.rs [..]`
-", running = RUNNING, compiling = COMPILING)));
+[COMPILING] a v0.5.0 ([..])
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]lib.rs [..]`
+")));
});
assert_that(p.cargo_process("test").arg("-v"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
-", running = RUNNING)));
+[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
+")));
});
test!(please_respect_the_dag {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} `rustc [..] -L native=foo -L native=bar[..]`
-", running = RUNNING)));
+[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`
+")));
});
test!(non_utf8_output {
use git2;
use support::{git, project, execs, main_file, path2url};
-use support::{COMPILING, UPDATING, RUNNING, ERROR};
use support::paths::{self, CargoPathExt};
use hamcrest::{assert_that,existing_file};
use cargo::util::process;
assert_that(project.cargo_process("build"),
execs()
- .with_stdout(&format!("{} git repository `{}`\n\
- {} dep1 v0.5.0 ({}#[..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING, path2url(git_root.clone()),
- COMPILING, path2url(git_root),
- COMPILING, path2url(root)))
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [COMPILING] dep1 v0.5.0 ({}#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ path2url(git_root.clone()),
+ path2url(git_root),
+ path2url(root)))
.with_stderr(""));
assert_that(&project.bin("foo"), existing_file());
assert_that(project.cargo_process("build"),
execs()
- .with_stdout(&format!("{} git repository `{}`\n\
- {} dep1 v0.5.0 ({}?branch=branchy#[..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING, path2url(git_root.clone()),
- COMPILING, path2url(git_root),
- COMPILING, path2url(root)))
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [COMPILING] dep1 v0.5.0 ({}?branch=branchy#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ path2url(git_root.clone()),
+ path2url(git_root),
+ path2url(root)))
.with_stderr(""));
assert_that(&project.bin("foo"), existing_file());
assert_that(project.cargo_process("build"),
execs()
- .with_stdout(&format!("{} git repository `{}`\n\
- {} dep1 v0.5.0 ({}?tag=v0.1.0#[..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING, path2url(git_root.clone()),
- COMPILING, path2url(git_root),
- COMPILING, path2url(root))));
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [COMPILING] dep1 v0.5.0 ({}?tag=v0.1.0#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ path2url(git_root.clone()),
+ path2url(git_root),
+ path2url(root))));
assert_that(&project.bin("foo"), existing_file());
execs()
.with_stdout("")
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
invalid url `{}`: relative URL without a base
-", url, error = ERROR)));
+", url)));
});
test!(two_revs_same_deps {
// First time around we should compile both foo and bar
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} git repository `{}`\n\
- {} bar v0.5.0 ({}#[..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING, git_project.url(),
- COMPILING, git_project.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [COMPILING] bar v0.5.0 ({}#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ git_project.url(),
+ git_project.url(),
+ p.url())));
// Don't recompile the second time
assert_that(p.cargo("build"),
execs().with_stdout(""));
assert_that(p.cargo("update"),
- execs().with_stdout(&format!("{} git repository `{}`",
- UPDATING,
+ execs().with_stdout(&format!("[UPDATING] git repository `{}`",
git_project.url())));
assert_that(p.cargo("build"),
// Update the dependency and carry on!
assert_that(p.cargo("update"),
- execs().with_stdout(&format!("{} git repository `{}`\n\
- {} bar v0.5.0 ([..]) -> #[..]\n\
+ execs().with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [UPDATING] bar v0.5.0 ([..]) -> #[..]\n\
",
- UPDATING,
- git_project.url(),
- UPDATING)));
+ git_project.url())));
println!("going for the last compile");
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}#[..])\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, git_project.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ git_project.url(),
+ p.url())));
// Make sure clean only cleans one dep
assert_that(p.cargo("clean")
.arg("-p").arg("foo"),
execs().with_stdout(""));
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} foo v0.5.0 ({})\n",
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] foo v0.5.0 ({})\n",
+ p.url())));
});
test!(update_with_shared_deps {
// First time around we should compile both foo and bar
assert_that(p.cargo_process("build"),
execs().with_stdout(&format!("\
-{updating} git repository `{git}`
-{compiling} bar v0.5.0 ({git}#[..])
-{compiling} [..] v0.5.0 ([..])
-{compiling} [..] v0.5.0 ([..])
-{compiling} foo v0.5.0 ({dir})\n",
- updating = UPDATING, git = git_project.url(),
- compiling = COMPILING, dir = p.url())));
+[UPDATING] git repository `{git}`
+[COMPILING] bar v0.5.0 ({git}#[..])
+[COMPILING] [..] v0.5.0 ([..])
+[COMPILING] [..] v0.5.0 ([..])
+[COMPILING] foo v0.5.0 ({dir})\n", git = git_project.url(), dir = p.url())));
// Modify a file manually, and commit it
File::create(&git_project.root().join("src/bar.rs")).unwrap().write_all(br#"
.arg("-p").arg("bar")
.arg("--precise").arg("0.1.2"),
execs().with_status(101).with_stderr(&format!("\
-{error} Unable to update [..]
+[ERROR] Unable to update [..]
To learn more, run the command again with --verbose.
-",
-error = ERROR)));
+")));
// Specifying a precise rev to the old rev shouldn't actually update
// anything because we already have the rev in the db.
assert_that(p.cargo("update")
.arg("-p").arg("dep1")
.arg("--aggressive"),
- execs().with_stdout(&format!("{} git repository `{}`\n\
- {} bar v0.5.0 ([..]) -> #[..]\n\
- ",
- UPDATING,
- git_project.url(),
- UPDATING)));
+ execs().with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [UPDATING] bar v0.5.0 ([..]) -> #[..]\n\
+ ", git_project.url())));
// Make sure we still only compile one version of the git repo
println!("build");
assert_that(p.cargo("build"),
execs().with_stdout(&format!("\
-{compiling} bar v0.5.0 ({git}#[..])
-{compiling} [..] v0.5.0 ({dir}[..]dep[..])
-{compiling} [..] v0.5.0 ({dir}[..]dep[..])
-{compiling} foo v0.5.0 ({dir})\n",
- git = git_project.url(),
- compiling = COMPILING, dir = p.url())));
+[COMPILING] bar v0.5.0 ({git}#[..])
+[COMPILING] [..] v0.5.0 ({dir}[..]dep[..])
+[COMPILING] [..] v0.5.0 ({dir}[..]dep[..])
+[COMPILING] foo v0.5.0 ({dir})\n",
+ git = git_project.url(), dir = p.url())));
// We should be able to update transitive deps
assert_that(p.cargo("update").arg("-p").arg("bar"),
- execs().with_stdout(&format!("{} git repository `{}`",
- UPDATING,
+ execs().with_stdout(&format!("[UPDATING] git repository `{}`",
git_project.url())));
});
assert_that(project.cargo_process("build"),
execs()
- .with_stdout(&format!("{} git repository `[..]`\n\
- {} git repository `[..]`\n\
- {} [..] v0.5.0 ([..])\n\
- {} [..] v0.5.0 ([..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING,
- UPDATING,
- COMPILING,
- COMPILING,
- COMPILING, project.url()))
+ .with_stdout(&format!("[UPDATING] git repository `[..]`\n\
+ [UPDATING] git repository `[..]`\n\
+ [COMPILING] [..] v0.5.0 ([..])\n\
+ [COMPILING] [..] v0.5.0 ([..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ project.url()))
.with_stderr(""));
File::create(&git1.root().join("src/lib.rs")).unwrap().write_all(br#"
assert_that(project.cargo("update")
.arg("-p").arg("dep1"),
execs()
- .with_stdout(&format!("{} git repository `{}`\n\
- {} dep1 v0.5.0 ([..]) -> #[..]\n\
- ",
- UPDATING,
- git1.url(),
- UPDATING))
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [UPDATING] dep1 v0.5.0 ([..]) -> #[..]\n\
+ ", git1.url()))
.with_stderr(""));
});
assert_that(foo.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `{bar}`
-{compiling} bar v0.0.0 ({bar}#[..])
-{compiling} foo v0.0.0 ({foo})
-", updating = UPDATING, compiling = COMPILING, bar = bar.url(), foo = foo.url())));
+[UPDATING] git repository `{bar}`
+[COMPILING] bar v0.0.0 ({bar}#[..])
+[COMPILING] foo v0.0.0 ({foo})
+", bar = bar.url(), foo = foo.url())));
assert_that(foo.process(&foo.bin("foo")), execs().with_status(0));
});
println!("first run");
assert_that(project.cargo_process("run"), execs()
- .with_stdout(&format!("{} git repository `[..]`\n\
- {} dep1 v0.5.0 ([..])\n\
- {} foo v0.5.0 ([..])\n\
- {} `target[..]foo[..]`\n\
- project2\
- ",
- UPDATING,
- COMPILING,
- COMPILING,
- RUNNING))
+ .with_stdout(&format!("[UPDATING] git repository `[..]`\n\
+ [COMPILING] dep1 v0.5.0 ([..])\n\
+ [COMPILING] foo v0.5.0 ([..])\n\
+ [RUNNING] `target[..]foo[..]`\n\
+ project2"))
.with_stderr("")
.with_status(0));
assert_that(project.cargo("update").arg("-v"),
execs()
.with_stderr("")
- .with_stdout(&format!("{} git repository `{}`\n\
- {} dep1 v0.5.0 ([..]) -> #[..]\n\
- ",
- UPDATING,
- git_project.url(),
- UPDATING)));
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [UPDATING] dep1 v0.5.0 ([..]) -> #[..]\n\
+ ", git_project.url())));
println!("last run");
assert_that(project.cargo("run"), execs()
- .with_stdout(&format!("{compiling} dep1 v0.5.0 ([..])\n\
- {compiling} foo v0.5.0 ([..])\n\
- {running} `target[..]foo[..]`\n\
+ .with_stdout(&format!("[COMPILING] dep1 v0.5.0 ([..])\n\
+ [COMPILING] foo v0.5.0 ([..])\n\
+ [RUNNING] `target[..]foo[..]`\n\
project3\
- ",
- compiling = COMPILING, running = RUNNING))
+ "))
.with_stderr("")
.with_status(0));
});
// `bar` to generate the lockfile
assert_that(p.cargo_process("build"),
execs().with_stdout(&format!("\
-{updating} git repository `{bar}`
-{compiling} foo v0.5.0 ({url})
-", updating = UPDATING, compiling = COMPILING, url = p.url(), bar = p2.url())));
+[UPDATING] git repository `{bar}`
+[COMPILING] foo v0.5.0 ({url})
+", url = p.url(), bar = p2.url())));
// Make sure we use the previous resolution of `bar` instead of updating it
// a second time.
assert_that(p.cargo("test"),
execs().with_stdout(&format!("\
-{compiling} [..] v0.5.0 ([..])
-{compiling} [..] v0.5.0 ([..]
-{running} target[..]foo-[..]
+[COMPILING] [..] v0.5.0 ([..])
+[COMPILING] [..] v0.5.0 ([..]
+[RUNNING] target[..]foo-[..]
running 1 test
test tests::foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING)));
+")));
});
test!(git_build_cmd_freshness {
assert_that(foo.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url})
-", compiling = COMPILING, url = foo.url())));
+[COMPILING] foo v0.0.0 ({url})
+", url = foo.url())));
// Smoke test to make sure it doesn't compile again
println!("first pass");
// `bar` to generate the lockfile
assert_that(p.cargo_process("build"),
execs().with_stdout(&format!("\
-{updating} git repository `{bar}`
-{compiling} foo v0.5.0 ({url})
-", updating = UPDATING, compiling = COMPILING, url = p.url(), bar = p2.url())));
+[UPDATING] git repository `{bar}`
+[COMPILING] foo v0.5.0 ({url})
+", url = p.url(), bar = p2.url())));
});
test!(git_repo_changing_no_rebuild {
p1.root().move_into_the_past().unwrap();
assert_that(p1.cargo("build"),
execs().with_stdout(&format!("\
-{updating} git repository `{bar}`
-{compiling} [..]
-{compiling} [..]
-", updating = UPDATING, compiling = COMPILING, bar = bar.url())));
+[UPDATING] git repository `{bar}`
+[COMPILING] [..]
+[COMPILING] [..]
+", bar = bar.url())));
// Make a commit to lock p2 to a different rev
File::create(&bar.root().join("src/lib.rs")).unwrap().write_all(br#"
.file("src/main.rs", "fn main() {}");
assert_that(p2.cargo_process("build"),
execs().with_stdout(&format!("\
-{updating} git repository `{bar}`
-{compiling} [..]
-{compiling} [..]
-", updating = UPDATING, compiling = COMPILING, bar = bar.url())));
+[UPDATING] git repository `{bar}`
+[COMPILING] [..]
+[COMPILING] [..]
+", bar = bar.url())));
// And now for the real test! Make sure that p1 doesn't get rebuilt
// even though the git repo has changed.
.file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("fetch"),
execs().with_status(0).with_stdout(&format!("\
-{updating} git repository `{url}`
-", updating = UPDATING, url = bar.url())));
+[UPDATING] git repository `{url}`
+", url = bar.url())));
assert_that(p.cargo("fetch"),
execs().with_status(0).with_stdout(""));
assert_that(p.cargo_process("build"),
execs()
- .with_stdout(&format!("{} git repository `{}`\n\
- {} bar v0.5.0 ({}#[..])\n\
- {} foo v0.5.0 ({})\n",
- UPDATING, bar.url(),
- COMPILING, bar.url(),
- COMPILING, p.url()))
+ .with_stdout(&format!("[UPDATING] git repository `{}`\n\
+ [COMPILING] bar v0.5.0 ({}#[..])\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ bar.url(),
+ bar.url(),
+ p.url()))
.with_stderr(""));
});
.arg("-p").arg("foo"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} There are multiple `foo` packages in your project, and the specification `foo` \
+[ERROR] There are multiple `foo` packages in your project, and the specification `foo` \
is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the \
following:
foo:0.[..].0
foo:0.[..].0
-",
-error = ERROR)));
+")));
});
test!(update_one_dep_in_repo_with_many_deps {
.arg("-p").arg("foo"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `{}`
-", foo.url(), updating = UPDATING)));
+[UPDATING] git repository `{}`
+", foo.url())));
});
test!(switch_deps_does_not_update_transitive {
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `{}`
-{updating} git repository `{}`
-{compiling} transitive [..]
-{compiling} dep [..]
-{compiling} project [..]
-", dep1.url(), transitive.url(), compiling = COMPILING, updating = UPDATING)));
+[UPDATING] git repository `{}`
+[UPDATING] git repository `{}`
+[COMPILING] transitive [..]
+[COMPILING] dep [..]
+[COMPILING] project [..]
+", dep1.url(), transitive.url())));
// Update the dependency to point to the second repository, but this
// shouldn't update the transitive dependency which is the same.
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `{}`
-{compiling} dep [..]
-{compiling} project [..]
-", dep2.url(), compiling = COMPILING, updating = UPDATING)));
+[UPDATING] git repository `{}`
+[COMPILING] dep [..]
+[COMPILING] project [..]
+", dep2.url())));
});
test!(update_one_source_updates_all_packages_in_that_git_source {
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `file://[..]a1`
-{compiling} a v0.5.0 ([..]a1#[..]
-{compiling} b v0.5.0 ([..])
-{compiling} project v0.5.0 ([..])
-", updating = UPDATING, compiling = COMPILING)));
+[UPDATING] git repository `file://[..]a1`
+[COMPILING] a v0.5.0 ([..]a1#[..]
+[COMPILING] b v0.5.0 ([..])
+[COMPILING] project v0.5.0 ([..])
+")));
File::create(&p.root().join("b/Cargo.toml")).unwrap().write_all(format!(r#"
[project]
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} git repository `file://[..]a2`
-{compiling} a v0.5.1 ([..]a2#[..]
-{compiling} b v0.5.0 ([..])
-{compiling} project v0.5.0 ([..])
-", updating = UPDATING, compiling = COMPILING)));
+[UPDATING] git repository `file://[..]a2`
+[COMPILING] a v0.5.1 ([..]a2#[..]
+[COMPILING] b v0.5.0 ([..])
+[COMPILING] project v0.5.0 ([..])
+")));
});
test!(dont_require_submodules_are_checked_out {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} git repository `[..]`
-{compiling} a v0.5.0 ([..])
-{compiling} foo v0.0.1 ([..])
-", compiling = COMPILING, updating = UPDATING)));
+[UPDATING] git repository `[..]`
+[COMPILING] a v0.5.0 ([..])
+[COMPILING] foo v0.0.1 ([..])
+")));
});
test!(denied_lints_are_allowed {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} git repository `[..]`
-{compiling} a v0.5.0 ([..])
-{compiling} foo v0.0.1 ([..])
-", compiling = COMPILING, updating = UPDATING)));
+[UPDATING] git repository `[..]`
+[COMPILING] a v0.5.0 ([..])
+[COMPILING] foo v0.0.1 ([..])
+")));
});
test!(add_a_git_dep {
use std::io::prelude::*;
use support::{project, execs, main_file};
-use support::{COMPILING, RUNNING, ERROR};
use support::paths::{self, CargoPathExt};
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
assert_that(p.cargo_process("build"),
execs().with_status(0)
- .with_stdout(&format!("{} baz v0.5.0 ({}/bar/baz)\n\
- {} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url(),
- COMPILING, p.url())));
+ .with_stdout(&format!("[COMPILING] baz v0.5.0 ({}/bar/baz)\n\
+ [COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url(),
+ p.url())));
assert_that(&p.bin("foo"), existing_file());
println!("building baz");
assert_that(p.cargo("build").arg("-p").arg("baz"),
execs().with_status(0)
- .with_stdout(&format!("{} baz v0.5.0 ({}/bar/baz)\n",
- COMPILING, p.url())));
+ .with_stdout(&format!("[COMPILING] baz v0.5.0 ({}/bar/baz)\n",
+ p.url())));
println!("building foo");
assert_that(p.cargo("build")
.arg("-p").arg("foo"),
execs().with_status(0)
- .with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ .with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
});
test!(cargo_compile_with_root_dev_deps {
p2.build();
assert_that(p.cargo_process("test"),
execs().with_stdout(&format!("\
-{compiling} [..] v0.5.0 ([..])
-{compiling} [..] v0.5.0 ([..])
-{running} target[..]foo-[..]
+[COMPILING] [..] v0.5.0 ([..])
+[COMPILING] [..] v0.5.0 ([..])
+[RUNNING] target[..]foo-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING)));
+")));
});
test!(cargo_compile_with_transitive_dev_deps {
"#);
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
assert_that(&p.bin("foo"), existing_file());
"#);
// First time around we should compile both foo and bar
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
// This time we shouldn't compile bar
assert_that(p.cargo("build"),
execs().with_stdout(""));
p.build(); // rebuild the files (rewriting them in the process)
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
});
test!(deep_dependencies_trigger_rebuild {
pub fn baz() {}
"#);
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
- {} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] baz v0.5.0 ({}/baz)\n\
+ [COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url(),
+ p.url())));
assert_that(p.cargo("build"),
execs().with_stdout(""));
pub fn baz() { println!("hello!"); }
"#).unwrap();
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
- {} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] baz v0.5.0 ({}/baz)\n\
+ [COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url(),
+ p.url())));
// Make sure an update to bar doesn't trigger baz
::sleep_ms(1000);
pub fn bar() { println!("hello!"); baz::baz(); }
"#).unwrap();
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
});
pub fn baz() {}
"#);
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} baz v0.5.0 ({}/baz)\n\
- {} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] baz v0.5.0 ({}/baz)\n\
+ [COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url(),
+ p.url())));
assert_that(&p.bin("foo"), existing_file());
assert_that(p.cargo("build"),
execs().with_stdout(""));
let bar = p.url();
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/src/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, bar,
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/src/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ bar,
+ p.url())));
p.root().move_into_the_past().unwrap();
File::create(&p.root().join("src/foo.rs")).unwrap().write_all(br#"
// This shouldn't recompile `bar`
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} foo v0.5.0 ({})\n",
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] foo v0.5.0 ({})\n",
+ p.url())));
});
test!(error_message_for_missing_manifest {
assert_that(p.cargo_process("build"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} Unable to update file://[..]
+[ERROR] Unable to update file://[..]
Caused by:
failed to read `[..]bar[..]Cargo.toml`
Caused by:
[..] (os error [..])
-",
-error = ERROR)));
+")));
});
p.root().join("bar").move_into_the_past().unwrap();
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
assert_that(&p.bin("foo"), existing_file());
}
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("{} bar v0.5.0 ({}/bar)\n\
- {} foo v0.5.0 ({})\n",
- COMPILING, p.url(),
- COMPILING, p.url())));
+ execs().with_stdout(&format!("[COMPILING] bar v0.5.0 ({}/bar)\n\
+ [COMPILING] foo v0.5.0 ({})\n",
+ p.url(),
+ p.url())));
assert_that(process(&p.bin("foo")),
execs().with_stdout("1\n"));
assert_that(p.cargo("build")
.env("FOO", "bar"),
execs().with_status(0)
- .with_stdout(&format!("{} foo v0.5.0 ({})\n",
- COMPILING, p.url())));
+ .with_stdout(&format!("[COMPILING] foo v0.5.0 ({})\n",
+ p.url())));
assert_that(p.cargo("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} [..] v0.5.0 ({url}[..])
-{compiling} [..] v0.5.0 ({url}[..])
-{running} target[..]foo-[..]
+[COMPILING] [..] v0.5.0 ({url}[..])
+[COMPILING] [..] v0.5.0 ({url}[..])
+[RUNNING] target[..]foo-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", url = p.url(), compiling = COMPILING, running = RUNNING)));
+", url = p.url())));
});
test!(custom_target_no_rebuild {
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} a v0.5.0 ([..])
-{compiling} foo v0.5.0 ([..])
-", compiling = COMPILING)));
+[COMPILING] a v0.5.0 ([..])
+[COMPILING] foo v0.5.0 ([..])
+")));
assert_that(p.cargo("build")
.arg("--manifest-path=b/Cargo.toml")
.env("CARGO_TARGET_DIR", "target"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} b v0.5.0 ([..])
-", compiling = COMPILING)));
+[COMPILING] b v0.5.0 ([..])
+")));
});
test!(override_and_depend {
assert_that(p.cargo("build").cwd(p.root().join("b")),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} a2 v0.5.0 ([..])
-{compiling} a1 v0.5.0 ([..])
-{compiling} b v0.5.0 ([..])
-", compiling = COMPILING)));
+[COMPILING] a2 v0.5.0 ([..])
+[COMPILING] a1 v0.5.0 ([..])
+[COMPILING] b v0.5.0 ([..])
+")));
});
test!(missing_path_dependency {
assert_that(p.cargo("build"),
execs().with_status(101)
.with_stderr(format!("\
-{error} failed to update path override `[..]../whoa-this-does-not-exist` \
+[ERROR] failed to update path override `[..]../whoa-this-does-not-exist` \
(defined in `[..]`)
Caused by:
Caused by:
[..] (os error [..])
-", error = ERROR)));
+")));
});
use std::env;
use support::{project, execs};
-use support::{COMPILING, RUNNING};
use hamcrest::assert_that;
fn setup() {
foo.build();
assert_that(bar.cargo_process("build").arg("--verbose"),
execs().with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
+")));
});
use git2;
use hamcrest::{assert_that, existing_file};
-use support::{execs, project, ERROR, COMPILING};
+use support::{execs, project};
use support::git;
use support::registry::Package;
use test_cargo_install::{cargo_home, has_installed_exe};
let (bad, good) = if a.status.code() == Some(101) {(a, b)} else {(b, a)};
assert_that(bad, execs().with_status(101).with_stderr_contains(&format!("\
-{error} binary `foo[..]` already exists in destination as part of `[..]`
-", error = ERROR)));
+[ERROR] binary `foo[..]` already exists in destination as part of `[..]`
+")));
assert_that(good, execs().with_status(0).with_stderr_contains("\
warning: be sure to add `[..]` to your PATH [..]
"));
p.build();
// Our build script will connect to our local TCP socket to inform us that
- // it's started running, and that's how we know that `a` will have the lock
+ // it's started and that's how we know that `a` will have the lock
// when we kill it.
let l = TcpListener::bind("127.0.0.1:0").unwrap();
let mut a = p.cargo("build").build_command();
let a = a.join().unwrap();
assert_that(a, execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.0 [..]
-", compiling = COMPILING)));
+[COMPILING] foo v0.0.0 [..]
+")));
assert_that(b, execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.0 [..]
-", compiling = COMPILING)));
+[COMPILING] foo v0.0.0 [..]
+")));
});
use std::env;
use support::{project, execs, basic_bin_manifest};
-use support::{RUNNING, COMPILING, DOCTEST, ERROR};
+use support::{DOCTEST};
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
.arg("-v"),
execs().with_status(101)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 ({url})
-{running} `rustc src[..]foo.rs --crate-name foo --crate-type bin -g \
+[COMPILING] foo v0.5.0 ({url})
+[RUNNING] `rustc src[..]foo.rs --crate-name foo --crate-type bin -g \
--out-dir {dir}[..]target[..]{target}[..]debug \
--emit=dep-info,link \
--target {target} \
-L dependency={dir}[..]target[..]{target}[..]debug \
-L dependency={dir}[..]target[..]{target}[..]debug[..]deps`
",
- running = RUNNING,
- compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
target = target,
assert_that(p.cargo_process("test").arg("--target").arg(&target),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({foo})
-{running} target[..]{triple}[..]bar-[..]
+[COMPILING] foo v0.0.0 ({foo})
+[RUNNING] target[..]{triple}[..]bar-[..]
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]{triple}[..]foo-[..]
+[RUNNING] target[..]{triple}[..]foo-[..]
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, foo = p.url(), triple = target)));
+", foo = p.url(), triple = target)));
});
test!(no_cross_doctests {
"#);
let host_output = format!("\
-{compiling} foo v0.0.0 ({foo})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.0 ({foo})
+[RUNNING] target[..]foo-[..]
running 0 tests
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, foo = p.url(), doctest = DOCTEST);
+", foo = p.url(), doctest = DOCTEST);
assert_that(p.cargo_process("test"),
execs().with_status(0)
assert_that(p.cargo_process("test").arg("--target").arg(&target),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 ({foo})
-{running} target[..]{triple}[..]foo-[..]
+[COMPILING] foo v0.0.0 ({foo})
+[RUNNING] target[..]{triple}[..]foo-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, foo = p.url(), triple = target)));
+", foo = p.url(), triple = target)));
});
test!(simple_cargo_run {
assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.0 (file://[..])
-{running} `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..]`
-{running} `{dir}[..]target[..]build[..]foo-[..]build-script-build`
-{running} `rustc src[..]main.rs [..] --target {target} [..]`
-", compiling = COMPILING, running = RUNNING, target = target,
+[COMPILING] foo v0.0.0 (file://[..])
+[RUNNING] `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..]`
+[RUNNING] `{dir}[..]target[..]build[..]foo-[..]build-script-build`
+[RUNNING] `rustc src[..]main.rs [..] --target {target} [..]`
+", target = target,
dir = p.root().display())));
});
assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{compiling} d1 v0.0.0 ({url}/d1)", compiling = COMPILING, url = p.url()))
+[COMPILING] d1 v0.0.0 ({url}/d1)", url = p.url()))
.with_stdout_contains(&format!("\
-{running} `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`",
- running = RUNNING, dir = p.root().display()))
+[RUNNING] `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`",
+ dir = p.root().display()))
.with_stdout_contains(&format!("\
-{running} `{dir}[..]target[..]build[..]d1-[..]build-script-build`", running = RUNNING,
+[RUNNING] `{dir}[..]target[..]build[..]d1-[..]build-script-build`",
dir = p.root().display()))
.with_stdout_contains(&format!("\
-{running} `rustc d1[..]src[..]lib.rs [..]`", running = RUNNING))
+[RUNNING] `rustc d1[..]src[..]lib.rs [..]`"))
.with_stdout_contains(&format!("\
-{compiling} d2 v0.0.0 ({url}/d2)", compiling = COMPILING, url = p.url()))
+[COMPILING] d2 v0.0.0 ({url}/d2)", url = p.url()))
.with_stdout_contains(&format!("\
-{running} `rustc d2[..]src[..]lib.rs [..] \
- -L /path/to/{host}`", running = RUNNING, host = host))
+[RUNNING] `rustc d2[..]src[..]lib.rs [..] \
+ -L /path/to/{host}`", host = host))
.with_stdout_contains(&format!("\
-{compiling} foo v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
+[COMPILING] foo v0.0.0 ({url})", url = p.url()))
.with_stdout_contains(&format!("\
-{running} `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..] \
- -L /path/to/{host}`", running = RUNNING, dir = p.root().display(), host = host))
+[RUNNING] `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..] \
+ -L /path/to/{host}`", dir = p.root().display(), host = host))
.with_stdout_contains(&format!("\
-{running} `rustc src[..]main.rs [..] --target {target} [..] \
- -L /path/to/{target}`", running = RUNNING, target = target)));
+[RUNNING] `rustc src[..]main.rs [..] --target {target} [..] \
+ -L /path/to/{target}`", target = target)));
});
test!(build_deps_for_the_right_arch {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(alternate()),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} `rustc build.rs [..]`
-{running} `[..]build-script-build[..]`
-{running} `rustc src[..]lib.rs [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc build.rs [..]`
+[RUNNING] `[..]build-script-build[..]`
+[RUNNING] `rustc src[..]lib.rs [..]`
+")));
});
test!(build_script_with_platform_specific_dependencies {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} d2 v0.0.0 ([..])
-{running} `rustc d2[..]src[..]lib.rs [..]`
-{compiling} d1 v0.0.0 ([..])
-{running} `rustc d1[..]src[..]lib.rs [..]`
-{compiling} foo v0.0.1 ([..])
-{running} `rustc build.rs [..]`
-{running} `{dir}[..]target[..]build[..]foo-[..]build-script-build`
-{running} `rustc src[..]lib.rs [..] --target {target} [..]`
-", compiling = COMPILING, running = RUNNING, dir = p.root().display(), target = target)));
+[COMPILING] d2 v0.0.0 ([..])
+[RUNNING] `rustc d2[..]src[..]lib.rs [..]`
+[COMPILING] d1 v0.0.0 ([..])
+[RUNNING] `rustc d1[..]src[..]lib.rs [..]`
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc build.rs [..]`
+[RUNNING] `{dir}[..]target[..]build[..]foo-[..]build-script-build`
+[RUNNING] `rustc src[..]lib.rs [..] --target {target} [..]`
+", dir = p.root().display(), target = target)));
});
test!(platform_specific_dependencies_do_not_leak {
[..] extern crate d2;
[..]
error: aborting due to previous error
-{error} Could not compile `d1`.
+[ERROR] Could not compile `d1`.
Caused by:
[..]
-", error = ERROR)));
+")));
});
test!(platform_specific_variables_reflected_in_build_scripts {
use std::fs;
use support::{project, execs, path2url};
-use support::{COMPILING, DOCUMENTING, RUNNING, ERROR};
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
fn setup() {
assert_that(p.cargo_process("doc"),
execs().with_status(0).with_stdout(&format!("\
-{documenting} foo v0.0.1 ({dir})
+[DOCUMENTING] foo v0.0.1 ({dir})
",
- documenting = DOCUMENTING,
dir = path2url(p.root()))));
assert_that(p.cargo("doc"),
execs().with_status(0).with_stdout(&format!("\
[..] bar v0.0.1 ({dir}/bar)
[..] bar v0.0.1 ({dir}/bar)
-{documenting} foo v0.0.1 ({dir})
+[DOCUMENTING] foo v0.0.1 ({dir})
",
- documenting = DOCUMENTING,
dir = path2url(p.root()))));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(p.cargo_process("doc").arg("--no-deps"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{documenting} foo v0.0.1 ({dir})
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[DOCUMENTING] foo v0.0.1 ({dir})
",
- documenting = DOCUMENTING, compiling = COMPILING,
dir = path2url(p.root()))));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(p.cargo_process("doc"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} cannot document a package where a library and a binary have the same name. \
+[ERROR] cannot document a package where a library and a binary have the same name. \
Consider renaming one or marking the target as `doc = false`
-",
-error = ERROR)));
+")));
});
test!(doc_dash_p {
.with_stdout(&format!("\
[..] b v0.0.1 (file://[..])
[..] b v0.0.1 (file://[..])
-{documenting} a v0.0.1 (file://[..])
-", documenting = DOCUMENTING)));
+[DOCUMENTING] a v0.0.1 (file://[..])
+")));
});
test!(doc_same_name {
assert_that(p.cargo("doc").arg("--release").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{documenting} foo v0.0.1 ([..])
-{running} `rustdoc src[..]lib.rs [..]`
-", documenting = DOCUMENTING, running = RUNNING)));
+[DOCUMENTING] foo v0.0.1 ([..])
+[RUNNING] `rustdoc src[..]lib.rs [..]`
+")));
});
test!(doc_multiple_deps {
use std::io::prelude::*;
use support::{project, execs};
-use support::{COMPILING, FRESH, ERROR};
use support::paths::CargoPathExt;
use hamcrest::assert_that;
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Feature `bar` includes `baz` which is neither a dependency nor another feature
-",
-error = ERROR)));
+")));
});
test!(invalid2 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Features and dependencies cannot have the same name: `bar`
-",
-error = ERROR)));
+")));
});
test!(invalid3 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Feature `bar` depends on `baz` which is not an optional dependency.
Consider adding `optional = true` to the dependency
-",
-error = ERROR)));
+")));
});
test!(invalid4 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} Package `bar v0.0.1 ([..])` does not have these features: `bar`
-",
-error = ERROR)));
+[ERROR] Package `bar v0.0.1 ([..])` does not have these features: `bar`
+")));
let p = p.file("Cargo.toml", r#"
[project]
assert_that(p.cargo_process("build").arg("--features").arg("test"),
execs().with_status(101).with_stderr(&format!("\
-{error} Package `foo v0.0.1 ([..])` does not have these features: `test`
-",
-error = ERROR)));
+[ERROR] Package `foo v0.0.1 ([..])` does not have these features: `test`
+")));
});
test!(invalid5 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Dev-dependencies are not allowed to be optional: `bar`
-",
-error = ERROR)));
+")));
});
test!(invalid6 {
assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Feature `foo` requires `bar` which is not an optional dependency
-",
-error = ERROR)));
+")));
});
test!(invalid7 {
assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
Feature `foo` requires `bar` which is not an optional dependency
-",
-error = ERROR)));
+")));
});
test!(invalid8 {
assert_that(p.cargo_process("build").arg("--features").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} features in dependencies cannot enable features in other dependencies: `foo/bar`
-",
-error = ERROR)));
+[ERROR] features in dependencies cannot enable features in other dependencies: `foo/bar`
+")));
});
test!(no_feature_doesnt_build {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
execs().with_status(0).with_stdout(""));
assert_that(p.cargo("build").arg("--features").arg("bar"),
execs().with_status(0).with_stdout(format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
execs().with_status(0).with_stdout("bar\n"));
});
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
execs().with_status(0).with_stdout("bar\n"));
assert_that(p.cargo("build").arg("--no-default-features"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
assert_that(p.process(&p.bin("foo")),
execs().with_status(0).with_stdout(""));
});
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} Cyclic feature dependency: feature `default` depends on itself
-",
-error = ERROR)));
+[ERROR] Cyclic feature dependency: feature `default` depends on itself
+")));
});
test!(cyclic_feature2 {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} Cyclic feature dependency: feature `[..]` depends on itself
-",
-error = ERROR)));
+[ERROR] Cyclic feature dependency: feature `[..]` depends on itself
+")));
});
test!(groups_on_groups_on_groups {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} ba[..] v0.0.1 ({dir}/ba[..])
-{compiling} ba[..] v0.0.1 ({dir}/ba[..])
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
+[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
});
test!(many_cli_features {
assert_that(p.cargo_process("build").arg("--features").arg("bar baz"),
execs().with_status(0).with_stdout(format!("\
-{compiling} ba[..] v0.0.1 ({dir}/ba[..])
-{compiling} ba[..] v0.0.1 ({dir}/ba[..])
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
+[COMPILING] ba[..] v0.0.1 ({dir}/ba[..])
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
});
test!(union_features {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} d2 v0.0.1 ({dir}/d2)
-{compiling} d1 v0.0.1 ({dir}/d1)
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] d2 v0.0.1 ({dir}/d2)
+[COMPILING] d1 v0.0.1 ({dir}/d1)
+[COMPILING] foo v0.0.1 ({dir})
+", dir = p.url())));
});
test!(many_features_no_rebuilds {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} a v0.1.0 ({dir}/a)
-{compiling} b v0.1.0 ({dir})
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] a v0.1.0 ({dir}/a)
+[COMPILING] b v0.1.0 ({dir})
+", dir = p.url())));
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("build").arg("-v"),
execs().with_status(0).with_stdout(format!("\
-{fresh} a v0.1.0 ([..]/a)
-{fresh} b v0.1.0 ([..])
-", fresh = FRESH)));
+[FRESH] a v0.1.0 ([..]/a)
+[FRESH] b v0.1.0 ([..])
+")));
});
// Tests that all cmd lines work with `--features ""`
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} test v0.1.0 ([..])
-", compiling = COMPILING)));
+[COMPILING] test v0.1.0 ([..])
+")));
});
test!(activating_feature_activates_dep {
use std::io::prelude::*;
use support::{project, execs, path2url};
-use support::COMPILING;
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file};
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = path2url(p.root()))));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = path2url(p.root()))));
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(""));
.write_all(b"fn main() {}").unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = path2url(p.root()))));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = path2url(p.root()))));
fs::rename(&p.root().join("src/a.rs"), &p.root().join("src/b.rs")).unwrap();
assert_that(p.cargo("build"),
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = path2url(p.root()))));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = path2url(p.root()))));
assert_that(p.cargo("test"),
execs().with_status(0));
::sleep_ms(1000);
assert_that(p.cargo("build")
.env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = path2url(p.root()))));
+[COMPILING] foo v0.0.1 ({dir})
+", dir = path2url(p.root()))));
assert_that(&p.bin("foo"), existing_file());
});
assert_that(p.cargo("test").arg("--no-run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} c v0.0.1 ([..])
-{compiling} b v0.0.1 ([..])
-{compiling} foo v0.0.1 ([..])
-", compiling = COMPILING)));
+[COMPILING] c v0.0.1 ([..])
+[COMPILING] b v0.0.1 ([..])
+[COMPILING] foo v0.0.1 ([..])
+")));
});
test!(rerun_if_changed_in_dep {
assert_that(p.cargo("build").cwd(p.root().join("a1")),
execs().with_status(0).with_stdout(&format!("\
-{compiling} d v0.0.1 ({dir}/d)
-{compiling} c v0.0.1 ({dir}/c)
-{compiling} b v0.0.1 ({dir}/b)
-{compiling} a1 v0.0.1 ({dir}/a1)
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] d v0.0.1 ({dir}/d)
+[COMPILING] c v0.0.1 ({dir}/c)
+[COMPILING] b v0.0.1 ({dir}/b)
+[COMPILING] a1 v0.0.1 ({dir}/a1)
+", dir = p.url())));
assert_that(p.cargo("build").cwd(p.root().join("a2")),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a2 v0.0.1 ({dir}/a2)
-", compiling = COMPILING, dir = p.url())));
+[COMPILING] a2 v0.0.1 ({dir}/a2)
+", dir = p.url())));
});
use std::io::prelude::*;
use std::env;
use tempdir::TempDir;
-use support::{execs, paths, cargo_dir, ERROR};
+use support::{execs, paths, cargo_dir};
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
use cargo::util::{process, ProcessBuilder};
assert_that(cargo_process("init").arg("--vcs").arg("none")
.env("USER", "foo").cwd(&path),
execs().with_status(101).with_stderr(&format!("\
-{error} cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`
-",
-error = ERROR)));
+[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`
+")));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
});
assert_that(cargo_process("init").arg("--vcs").arg("none")
.env("USER", "foo").cwd(&path),
execs().with_status(101).with_stderr(&format!("\
-{error} multiple possible binary sources found:
+[ERROR] multiple possible binary sources found:
main.rs
foo.rs
cannot automatically generate Cargo.toml as the main target would be ambiguous
-",
-error = ERROR)));
+")));
assert_that(&paths::root().join("foo/Cargo.toml"), is_not(existing_file()));
});
assert_that(cargo_process("init").cwd(foo.clone())
.env("USER", "foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} Invalid character `.` in crate name: `foo.bar`
+[ERROR] Invalid character `.` in crate name: `foo.bar`
use --name to override crate name
-",
-error = ERROR)));
+")));
assert_that(&foo.join("Cargo.toml"), is_not(existing_file()));
});
assert_that(cargo_process("init").cwd(test.clone())
.env("USER", "foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} The name `test` cannot be used as a crate name\n\
+[ERROR] The name `test` cannot be used as a crate name\n\
use --name to override crate name
-",
-error = ERROR)));
+")));
assert_that(&test.join("Cargo.toml"), is_not(existing_file()));
});
assert_that(cargo_process("init").arg("foo").arg("--flag"),
execs().with_status(1)
.with_stderr(&format!("\
-{error} Unknown flag: '--flag'
+[ERROR] Unknown flag: '--flag'
Usage:
cargo init [options] [<path>]
cargo init -h | --help
-",
-error = ERROR)));
+")));
});
#[cfg(not(windows))]
assert_that(cargo_process("init").arg("/"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} cannot auto-detect project name from path \"/\" ; use --name to override
-",
-error = ERROR)));
+[ERROR] cannot auto-detect project name from path \"/\" ; use --name to override
+")));
});
use hamcrest::{assert_that, existing_file, is_not, Matcher, MatchResult};
use support::{project, execs};
-use support::{UPDATING, DOWNLOADING, COMPILING, INSTALLING, REPLACING, REMOVING, ERROR};
+use support::{DOWNLOADING, INSTALLING, REPLACING, REMOVING};
use support::paths;
use support::registry::Package;
use support::git;
assert_that(cargo_process("install").arg("foo"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} foo v0.0.2 (registry file://[..])
-{compiling} foo v0.0.2 (registry file://[..])
+[COMPILING] foo v0.0.2 (registry file://[..])
{installing} {home}[..]bin[..]foo[..]
",
- updating = UPDATING,
downloading = DOWNLOADING,
- compiling = COMPILING,
installing = INSTALLING,
home = cargo_home().display())));
assert_that(cargo_home(), has_installed_exe("foo"));
pkg("foo", "0.0.1");
assert_that(cargo_process("install").arg("bar"),
execs().with_status(101).with_stderr(&format!("\
-{error} could not find `bar` in `registry file://[..]`
-",
-error = ERROR)));
+[ERROR] could not find `bar` in `registry file://[..]`
+")));
});
test!(bad_version {
pkg("foo", "0.0.1");
assert_that(cargo_process("install").arg("foo").arg("--vers=0.2.0"),
execs().with_status(101).with_stderr(&format!("\
-{error} could not find `foo` in `registry file://[..]` with version `0.2.0`
-",
-error = ERROR)));
+[ERROR] could not find `foo` in `registry file://[..]` with version `0.2.0`
+")));
});
test!(no_crate {
assert_that(cargo_process("install"),
execs().with_status(101).with_stderr(&format!("\
-{error} `[..]` is not a crate root; specify a crate to install [..]
+[ERROR] `[..]` is not a crate root; specify a crate to install [..]
Caused by:
failed to read `[..]Cargo.toml`
Caused by:
[..] (os error [..])
-",
-error = ERROR)));
+")));
});
test!(install_location_precedence {
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()),
execs().with_status(101).with_stderr(&format!("\
-{error} binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
+[ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
Add --force to overwrite
-",
-error = ERROR)));
+")));
});
test!(multiple_crates_error {
assert_that(cargo_process("install").arg("--git").arg(p.url().to_string()),
execs().with_status(101).with_stderr(&format!("\
-{error} multiple packages with binaries found: bar, foo
-",
-error = ERROR)));
+[ERROR] multiple packages with binaries found: bar, foo
+")));
});
test!(multiple_crates_select {
assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr(&format!("\
-{error} no packages found with binaries or examples
-",
-error = ERROR)));
+[ERROR] no packages found with binaries or examples
+")));
});
test!(no_binaries {
assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} specified package has no binaries
-",
-error = ERROR)));
+[ERROR] specified package has no binaries
+")));
});
test!(examples {
execs().with_status(0));
assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr(&format!("\
-{error} binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
+[ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
Add --force to overwrite
-",
-error = ERROR)));
+")));
});
test!(install_force {
assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.2.0 ([..])
+[COMPILING] foo v0.2.0 ([..])
{replacing} {home}[..]bin[..]foo[..]
",
- compiling = COMPILING,
replacing = REPLACING,
home = cargo_home().display())));
assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.2.0 ([..])
+[COMPILING] foo v0.2.0 ([..])
{installing} {home}[..]bin[..]foo-bin3[..]
{replacing} {home}[..]bin[..]foo-bin2[..]
",
- compiling = COMPILING,
installing = INSTALLING,
replacing = REPLACING,
home = cargo_home().display())));
.arg("--path")
.arg(p.root()),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.2.0 ([..])
+[COMPILING] foo v0.2.0 ([..])
{replacing} {home}[..]bin[..]foo-bin2[..]
",
- compiling = COMPILING,
replacing = REPLACING,
home = cargo_home().display())));
execs().with_status(101).with_stderr(&format!("\
error: main function not found
error: aborting due to previous error
-{error} failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \
+[ERROR] failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \
found at `[..]target`
Caused by:
Could not compile `foo`.
To learn more, run the command again with --verbose.
-",
-error = ERROR)));
+")));
});
test!(git_repo {
assert_that(cargo_process("install").arg("--git").arg(p.url().to_string()),
execs().with_status(0).with_stdout(&format!("\
-{updating} git repository `[..]`
-{compiling} foo v0.1.0 ([..])
+[UPDATING] git repository `[..]`
+[COMPILING] foo v0.1.0 ([..])
{installing} {home}[..]bin[..]foo[..]
",
- updating = UPDATING,
- compiling = COMPILING,
installing = INSTALLING,
home = cargo_home().display())));
assert_that(cargo_home(), has_installed_exe("foo"));
test!(uninstall_pkg_does_not_exist {
assert_that(cargo_process("uninstall").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} package id specification `foo` matched no packages
-",
-error = ERROR)));
+[ERROR] package id specification `foo` matched no packages
+")));
});
test!(uninstall_bin_does_not_exist {
execs().with_status(0));
assert_that(cargo_process("uninstall").arg("foo").arg("--bin=bar"),
execs().with_status(101).with_stderr(&format!("\
-{error} binary `bar[..]` not installed as part of `foo v0.0.1 ([..])`
-",
-error = ERROR)));
+[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1 ([..])`
+")));
});
test!(uninstall_piecemeal {
assert_that(cargo_process("uninstall").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} package id specification `foo` matched no packages
-",
-error = ERROR)));
+[ERROR] package id specification `foo` matched no packages
+")));
});
test!(subcommand_works_out_of_the_box {
execs().with_status(101).with_stderr_contains("\
thread '<main>' panicked at 'explicit panic', [..]
").with_stderr_contains(format!("\
-{error} third party subcommand `cargo-fail[..]` exited unsuccessfully
+[ERROR] third party subcommand `cargo-fail[..]` exited unsuccessfully
To learn more, run the command again with --verbose.
-",
-error = ERROR)));
+")));
});
test!(git_with_lockfile {
use hamcrest::assert_that;
use support::registry::Package;
-use support::{project, execs, basic_bin_manifest, main_file, ERROR};
+use support::{project, execs, basic_bin_manifest, main_file};
fn setup() {}
assert_that(p.cargo_process("metadata"), execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
- no `package` or `project` section found.",
- error = ERROR)))
+ no `package` or `project` section found.")))
});
const MANIFEST_OUTPUT: &'static str=
.arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("{error} the manifest-path must be \
- a path to a Cargo.toml file",
- error = ERROR)));
+ .with_stderr(&format!("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file")));
});
test!(cargo_metadata_no_deps_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("{error} the manifest-path must be \
- a path to a Cargo.toml file",
- error = ERROR)));
+ .with_stderr(&format!("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file")));
});
test!(cargo_metadata_no_deps_cwd {
.arg("--format-version").arg("2")
.cwd(p.root()),
execs().with_status(101)
- .with_stderr(&format!("{error} metadata version 2 not supported, only 1 is currently supported",
- error = ERROR)));
+ .with_stderr("[ERROR] metadata version 2 not supported, only 1 is currently supported"));
});
use std::env;
use tempdir::TempDir;
-use support::{execs, paths, ERROR};
+use support::{execs, paths};
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
assert_that(cargo_process("new"),
execs().with_status(1)
.with_stderr(&format!("\
-{error} Invalid arguments.
+[ERROR] Invalid arguments.
Usage:
cargo new [options] <path>
cargo new -h | --help
-",
-error = ERROR)));
+")));
});
test!(existing {
fs::create_dir(&dst).unwrap();
assert_that(cargo_process("new").arg("foo"),
execs().with_status(101)
- .with_stderr(format!("{error} destination `{}` already exists\n",
- dst.display(), error = ERROR)));
+ .with_stderr(format!("[ERROR] destination `{}` already exists\n",
+ dst.display())));
});
test!(invalid_characters {
assert_that(cargo_process("new").arg("foo.rs"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} Invalid character `.` in crate name: `foo.rs`
-use --name to override crate name",
-error = ERROR)));
+[ERROR] Invalid character `.` in crate name: `foo.rs`
+use --name to override crate name")));
});
test!(reserved_name {
assert_that(cargo_process("new").arg("test"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} The name `test` cannot be used as a crate name\n\
-use --name to override crate name",
-error = ERROR)));
+[ERROR] The name `test` cannot be used as a crate name\n\
+use --name to override crate name")));
});
test!(rust_prefix_stripped {
assert_that(cargo_process("new").arg("foo").arg("--flag"),
execs().with_status(1)
.with_stderr(&format!("\
-{error} Unknown flag: '--flag'
+[ERROR] Unknown flag: '--flag'
Usage:
cargo new [..]
cargo new [..]
-",
-error = ERROR)));
+")));
});
use hamcrest::assert_that;
use support::registry::{registry, Package};
-use support::{execs, project, UPDATING, DOWNLOADING, COMPILING};
+use support::{execs, project, DOWNLOADING};
use support::git;
use support::paths;
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{updating} git repository `[..]`
-{compiling} foo v0.1.0 (file://[..])
-{compiling} local v0.0.1 (file://[..])
-",
- updating = UPDATING, compiling = COMPILING)));
+[UPDATING] registry `file://[..]`
+[UPDATING] git repository `[..]`
+[COMPILING] foo v0.1.0 (file://[..])
+[COMPILING] local v0.0.1 (file://[..])
+")));
});
test!(missing_version {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{updating} git repository `[..]`
+[UPDATING] registry `file://[..]`
+[UPDATING] git repository `[..]`
{downloading} bar v0.2.0 (registry [..])
-{compiling} foo v0.1.0 (file://[..])
-{compiling} bar v0.2.0 (registry [..])
-{compiling} local v0.0.1 (file://[..])
-",
- updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING)));
+[COMPILING] foo v0.1.0 (file://[..])
+[COMPILING] bar v0.2.0 (registry [..])
+[COMPILING] local v0.0.1 (file://[..])
+", downloading = DOWNLOADING)));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
});
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{updating} git repository `file://[..]`
-{compiling} foo v0.1.0 (file://[..])
-{compiling} local v0.0.1 (file://[..])
-",
- updating = UPDATING, compiling = COMPILING)));
+[UPDATING] registry `file://[..]`
+[UPDATING] git repository `file://[..]`
+[COMPILING] foo v0.1.0 (file://[..])
+[COMPILING] local v0.0.1 (file://[..])
+")));
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(""));
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{compiling} foo v0.1.0 (file://[..])
-{compiling} local v0.0.1 (file://[..])
-",
- compiling = COMPILING, updating = UPDATING)));
+[UPDATING] registry `file://[..]`
+[COMPILING] foo v0.1.0 (file://[..])
+[COMPILING] local v0.0.1 (file://[..])
+")));
});
test!(use_a_spec_to_select {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{updating} git repository `[..]`
+[UPDATING] registry `file://[..]`
+[UPDATING] git repository `[..]`
{downloading} [..]
{downloading} [..]
-{compiling} [..]
-{compiling} [..]
-{compiling} [..]
-{compiling} local v0.0.1 (file://[..])
-",
- updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING)));
+[COMPILING] [..]
+[COMPILING] [..]
+[COMPILING] [..]
+[COMPILING] local v0.0.1 (file://[..])
+", downloading = DOWNLOADING)));
});
test!(override_adds_some_deps {
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-{updating} git repository `[..]`
+[UPDATING] registry `file://[..]`
+[UPDATING] git repository `[..]`
{downloading} foo v0.1.1 (registry [..])
-{compiling} foo v0.1.1 (registry [..])
-{compiling} bar v0.1.0 ([..])
-{compiling} local v0.0.1 (file://[..])
-",
- updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING)));
+[COMPILING] foo v0.1.1 (registry [..])
+[COMPILING] bar v0.1.0 ([..])
+[COMPILING] local v0.0.1 (file://[..])
+", downloading = DOWNLOADING)));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
Package::new("foo", "0.1.2").publish();
assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", foo.url())),
execs().with_status(0).with_stdout(&format!("\
-{updating} git repository `file://[..]`
-", updating = UPDATING)));
+[UPDATING] git repository `file://[..]`
+")));
assert_that(p.cargo("update").arg("-p").arg(&format!("{}#bar", registry())),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `file://[..]`
-", updating = UPDATING)));
+[UPDATING] registry `file://[..]`
+")));
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
});
use tar::Archive;
use support::{project, execs, paths, git, path2url};
-use support::{PACKAGING, VERIFYING, COMPILING, ARCHIVING};
+use support::{PACKAGING, VERIFYING, ARCHIVING};
use hamcrest::{assert_that, existing_file};
fn setup() {
execs().with_status(0).with_stdout(&format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url())));
assert_that(&p.root().join("target/package/foo-0.0.1.crate"), existing_file());
assert_that(p.cargo("package").arg("-l"),
execs().with_status(0).with_stdout(&format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url()))
.with_stderr("\
warning: manifest has no description, license, license-file, documentation, \
execs().with_status(0).with_stdout(&format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url()))
.with_stderr("\
warning: manifest has no description, documentation, homepage or repository. See \
execs().with_status(0).with_stdout(&format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url())));
});
execs().with_status(0).with_stdout(&format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url())));
});
execs().with_status(0).with_stdout(&format!("\
{packaging} nested v0.0.1 ({dir})
{verifying} nested v0.0.1 ({dir})
-{compiling} nested v0.0.1 ({dir}[..])
+[COMPILING] nested v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- compiling = COMPILING,
dir = p.url())));
assert_that(&p.root().join("target/package/nested-0.0.1.crate"), existing_file());
assert_that(p.cargo("package").arg("-l"),
#[cfg(unix)] // windows doesn't allow these characters in filenames
test!(package_weird_characters {
-
- use support::ERROR;
let p = project("foo")
.file("Cargo.toml", r#"
[project]
assert_that(p.cargo_process("package"),
execs().with_status(101).with_stderr(format!("\
warning: [..]
-{error} failed to prepare local package for uploading
+[ERROR] failed to prepare local package for uploading
Caused by:
cannot package a filename with a special character `:`: src/:foo
-",
-error = ERROR)));
+")));
});
use std::path::MAIN_SEPARATOR as SEP;
use support::{project, execs};
-use support::{COMPILING, RUNNING};
use hamcrest::assert_that;
fn setup() {
.file("src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} test v0.0.0 ({url})
-{running} `rustc src{sep}lib.rs --crate-name test --crate-type lib \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \
-C opt-level=1 \
-C debug-assertions=on \
-C rpath \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
-running = RUNNING, compiling = COMPILING, sep = SEP,
+", sep = SEP,
dir = p.root().display(),
url = p.url(),
)));
.file("foo/src/lib.rs", "");
assert_that(p.cargo_process("build").arg("-v").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.0 ({url}/foo)
-{running} `rustc foo{sep}src{sep}lib.rs --crate-name foo \
+[COMPILING] foo v0.0.0 ({url}/foo)
+[RUNNING] `rustc foo{sep}src{sep}lib.rs --crate-name foo \
--crate-type dylib --crate-type rlib -C prefer-dynamic \
-C opt-level=1 \
-g \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}release{sep}deps \
-L dependency={dir}{sep}target{sep}release{sep}deps`
-{compiling} test v0.0.0 ({url})
-{running} `rustc src{sep}lib.rs --crate-name test --crate-type lib \
+[COMPILING] test v0.0.0 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \
-C opt-level=1 \
-g \
--out-dir {dir}{sep}target{sep}release \
{prefix}foo-[..]{suffix} \
--extern foo={dir}{sep}target{sep}release{sep}deps{sep}libfoo-[..].rlib`
",
- running = RUNNING,
- compiling = COMPILING,
dir = p.root().display(),
url = p.url(),
sep = SEP,
use url::Url;
use support::{project, execs};
-use support::{UPDATING, PACKAGING, UPLOADING, ERROR};
+use support::{PACKAGING, UPLOADING};
use support::paths;
use support::git::repo;
assert_that(p.cargo_process("publish").arg("--no-verify"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `{reg}`
+[UPDATING] registry `{reg}`
{packaging} foo v0.0.1 ({dir})
{uploading} foo v0.0.1 ({dir})
",
- updating = UPDATING,
uploading = UPLOADING,
packaging = PACKAGING,
dir = p.url(),
assert_that(p.cargo_process("publish").arg("-v").arg("--no-verify"),
execs().with_status(101).with_stderr(&format!("\
-{error} all dependencies must come from the same source.
+[ERROR] all dependencies must come from the same source.
dependency `foo` comes from git://path/to/nowhere instead
-",
-error = ERROR)));
+")));
});
test!(path_dependency_no_version {
assert_that(p.cargo_process("publish"),
execs().with_status(101).with_stderr(&format!("\
-{error} all path dependencies must have a version specified when publishing.
+[ERROR] all path dependencies must have a version specified when publishing.
dependency `bar` does not specify a version
-",
-error = ERROR)));
+")));
});
test!(unpublishable_crate {
assert_that(p.cargo_process("publish"),
execs().with_status(101).with_stderr(&format!("\
-{error} some crates cannot be published.
+[ERROR] some crates cannot be published.
`foo` is marked as unpublishable
-",
-error = ERROR)));
+")));
});
-use support::{project, execs, main_file, basic_bin_manifest, ERROR};
+use support::{project, execs, main_file, basic_bin_manifest};
use hamcrest::{assert_that};
fn setup() {}
.arg("--manifest-path").arg("foo")
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("{error} the manifest-path must be \
- a path to a Cargo.toml file", error = ERROR)));
+ .with_stderr(&format!("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file")));
});
test!(cargo_read_manifest_path_to_cargo_toml_parent_absolute {
.arg("--manifest-path").arg(p.root())
.cwd(p.root().parent().unwrap()),
execs().with_status(101)
- .with_stderr(&format!("{error} the manifest-path must be \
- a path to a Cargo.toml file", error = ERROR)));
+ .with_stderr(&format!("[ERROR] the manifest-path must be \
+ a path to a Cargo.toml file")));
});
test!(cargo_read_manifest_cwd {
use std::io::prelude::*;
use support::{project, execs};
-use support::{UPDATING, DOWNLOADING, COMPILING, PACKAGING, VERIFYING, ADDING, REMOVING, ERROR};
+use support::{DOWNLOADING, PACKAGING, VERIFYING, ADDING, REMOVING};
use support::paths::{self, CargoPathExt};
use support::registry::{self, Package};
use support::git;
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `{reg}`
+[UPDATING] registry `{reg}`
{downloading} bar v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
",
- updating = UPDATING,
downloading = DOWNLOADING,
- compiling = COMPILING,
dir = p.url(),
reg = registry::registry())));
// Don't download a second time
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `{reg}`
+[UPDATING] registry `{reg}`
[..] bar v0.0.1 (registry file://[..])
[..] foo v0.0.1 ({dir})
",
- updating = UPDATING,
dir = p.url(),
reg = registry::registry())));
});
assert_that(p.cargo_process("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `{reg}`
+[UPDATING] registry `{reg}`
{downloading} [..] v0.0.1 (registry file://[..])
{downloading} [..] v0.0.1 (registry file://[..])
-{compiling} baz v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
+[COMPILING] baz v0.0.1 (registry file://[..])
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
",
- updating = UPDATING,
downloading = DOWNLOADING,
- compiling = COMPILING,
dir = p.url(),
reg = registry::registry())));
});
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `nonexistent` found (required by `foo`)
+[ERROR] no matching package named `nonexistent` found (required by `foo`)
location searched: registry file://[..]
version required: >= 0.0.0
-",
-error = ERROR)));
+")));
});
test!(wrong_version {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `foo` found (required by `foo`)
+[ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry file://[..]
version required: >= 1.0.0
versions found: 0.0.2, 0.0.1
-",
-error = ERROR)));
+")));
Package::new("foo", "0.0.3").publish();
Package::new("foo", "0.0.4").publish();
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `foo` found (required by `foo`)
+[ERROR] no matching package named `foo` found (required by `foo`)
location searched: registry file://[..]
version required: >= 1.0.0
versions found: 0.0.4, 0.0.3, 0.0.2, ...
-",
-error = ERROR)));
+")));
});
test!(bad_cksum {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(101).with_stderr(&format!("\
-{error} unable to get packages from source
+[ERROR] unable to get packages from source
Caused by:
failed to download package `bad-cksum v0.0.1 (registry file://[..])` from [..]
Caused by:
failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])`
-",
-error = ERROR)));
+")));
});
test!(update_registry {
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `notyet` found (required by `foo`)
+[ERROR] no matching package named `notyet` found (required by `foo`)
location searched: registry file://[..]
version required: >= 0.0.0
-",
-error = ERROR)));
+")));
Package::new("notyet", "0.0.1").publish();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `{reg}`
+[UPDATING] registry `{reg}`
{downloading} notyet v0.0.1 (registry file://[..])
-{compiling} notyet v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
+[COMPILING] notyet v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
",
- updating = UPDATING,
downloading = DOWNLOADING,
- compiling = COMPILING,
dir = p.url(),
reg = registry::registry())));
});
assert_that(p.cargo("package").arg("-v"),
execs().with_status(101).with_stderr(&format!("\
-{error} failed to verify package tarball
+[ERROR] failed to verify package tarball
Caused by:
no matching package named `notyet` found (required by `foo`)
location searched: registry file://[..]
version required: ^0.0.1
-",
-error = ERROR)));
+")));
Package::new("notyet", "0.0.1").publish();
execs().with_status(0).with_stdout(format!("\
{packaging} foo v0.0.1 ({dir})
{verifying} foo v0.0.1 ({dir})
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} notyet v0.0.1 (registry file://[..])
-{compiling} notyet v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir}[..])
+[COMPILING] notyet v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir}[..])
",
packaging = PACKAGING,
verifying = VERIFYING,
- updating = UPDATING,
downloading = DOWNLOADING,
- compiling = COMPILING,
dir = p.url(),
)));
});
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} bar v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} [..] v0.0.1 (registry file://[..])
{downloading} [..] v0.0.1 (registry file://[..])
-{compiling} baz v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] baz v0.0.1 (registry file://[..])
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} [..] v0.0.1 (registry file://[..])
{downloading} [..] v0.0.1 (registry file://[..])
-{compiling} baz v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] baz v0.0.1 (registry file://[..])
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
});
assert_that(p.cargo("build"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `baz` found (required by `bar`)
+[ERROR] no matching package named `baz` found (required by `bar`)
location searched: registry file://[..]
version required: = 0.0.2
versions found: 0.0.1
-",
-error = ERROR)));
+")));
});
test!(yanks_in_lockfiles_are_ok {
assert_that(p.cargo("update"),
execs().with_status(101).with_stderr(&format!("\
-{error} no matching package named `bar` found (required by `foo`)
+[ERROR] no matching package named `bar` found (required by `foo`)
location searched: registry file://[..]
version required: *
-",
-error = ERROR)));
+")));
});
test!(update_with_lockfile_if_packages_missing {
paths::home().join(".cargo/registry").rm_rf().unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} bar v0.0.1 (registry file://[..])
-", updating = UPDATING, downloading = DOWNLOADING)));
+", downloading = DOWNLOADING)));
});
test!(update_lockfile {
assert_that(p.cargo("update")
.arg("-p").arg("bar").arg("--precise").arg("0.0.2"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
-{updating} bar v0.0.1 (registry file://[..]) -> v0.0.2
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+[UPDATING] bar v0.0.1 (registry file://[..]) -> v0.0.2
+")));
println!("0.0.2 build");
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
{downloading} [..] v0.0.2 (registry file://[..])
-{compiling} bar v0.0.2 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.0.2 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
println!("0.0.3 update");
assert_that(p.cargo("update")
.arg("-p").arg("bar"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
-{updating} bar v0.0.2 (registry file://[..]) -> v0.0.3
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+[UPDATING] bar v0.0.2 (registry file://[..]) -> v0.0.3
+")));
println!("0.0.3 build");
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
{downloading} [..] v0.0.3 (registry file://[..])
-{compiling} bar v0.0.3 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.0.3 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
println!("new dependencies update");
assert_that(p.cargo("update")
.arg("-p").arg("bar"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
-{updating} bar v0.0.3 (registry file://[..]) -> v0.0.4
+[UPDATING] registry `[..]`
+[UPDATING] bar v0.0.3 (registry file://[..]) -> v0.0.4
{adding} spam v0.2.5 (registry file://[..])
-", updating = UPDATING, adding = ADDING)));
+", adding = ADDING)));
println!("new dependencies update");
Package::new("bar", "0.0.5").publish();
assert_that(p.cargo("update")
.arg("-p").arg("bar"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
-{updating} bar v0.0.4 (registry file://[..]) -> v0.0.5
+[UPDATING] registry `[..]`
+[UPDATING] bar v0.0.4 (registry file://[..]) -> v0.0.5
{removing} spam v0.2.5 (registry file://[..])
-", updating = UPDATING, removing = REMOVING)));
+", removing = REMOVING)));
});
test!(dev_dependency_not_used {
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} [..] v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
});
assert_that(p.cargo_process("publish").arg("-v"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} the license file `foo` does not exist", error = ERROR)));
+[ERROR] the license file `foo` does not exist")));
});
test!(updating_a_dep {
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} bar v0.0.1 (registry file://[..])
-{compiling} bar v0.0.1 (registry file://[..])
-{compiling} a v0.0.1 ({dir}/a)
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.0.1 (registry file://[..])
+[COMPILING] a v0.0.1 ({dir}/a)
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
File::create(&p.root().join("a/Cargo.toml")).unwrap().write_all(br#"
println!("second");
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} bar v0.1.0 (registry file://[..])
-{compiling} bar v0.1.0 (registry file://[..])
-{compiling} a v0.0.1 ({dir}/a)
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] bar v0.1.0 (registry file://[..])
+[COMPILING] a v0.0.1 ({dir}/a)
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
});
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} [..]
-{updating} [..]
+[UPDATING] [..]
+[UPDATING] [..]
{downloading} a v0.0.1 (registry file://[..])
-{compiling} a v0.0.1 (registry [..])
-{compiling} b v0.0.1 ([..])
-{compiling} foo v0.0.1 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] a v0.0.1 (registry [..])
+[COMPILING] b v0.0.1 ([..])
+[COMPILING] foo v0.0.1 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
p.root().move_into_the_past().unwrap();
fs::remove_dir_all(&p.root().join("target")).unwrap();
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} [..]
+[UPDATING] [..]
{downloading} a v0.1.1 (registry file://[..])
-{compiling} a v0.1.1 (registry [..])
-{compiling} foo v0.5.0 ({dir})
-", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
+[COMPILING] a v0.1.1 (registry [..])
+[COMPILING] foo v0.5.0 ({dir})
+", downloading = DOWNLOADING,
dir = p.url())));
});
assert_that(p.cargo("fetch"),
execs().with_status(0)
.with_stdout(format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} a v0.1.0 (registry [..])
-", updating = UPDATING, downloading = DOWNLOADING)));
+", downloading = DOWNLOADING)));
});
test!(update_transitive_dependency {
assert_that(p.cargo("update").arg("-pb"),
execs().with_status(0)
.with_stdout(format!("\
-{updating} registry `[..]`
-{updating} b v0.1.0 (registry [..]) -> v0.1.1
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+[UPDATING] b v0.1.0 (registry [..]) -> v0.1.1
+")));
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout(format!("\
{downloading} b v0.1.1 (registry file://[..])
-{compiling} b v0.1.1 (registry [..])
-{compiling} a v0.1.0 (registry [..])
-{compiling} foo v0.5.0 ([..])
-", downloading = DOWNLOADING, compiling = COMPILING)));
+[COMPILING] b v0.1.1 (registry [..])
+[COMPILING] a v0.1.0 (registry [..])
+[COMPILING] foo v0.5.0 ([..])
+", downloading = DOWNLOADING)));
});
test!(update_backtracking_ok {
assert_that(p.cargo("update").arg("-p").arg("hyper"),
execs().with_status(0)
.with_stdout(&format!("\
-{updating} registry `[..]`
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+")));
});
test!(update_multiple_packages {
assert_that(p.cargo("update").arg("-pa").arg("-pb"),
execs().with_status(0)
.with_stdout(format!("\
-{updating} registry `[..]`
-{updating} a v0.1.0 (registry [..]) -> v0.1.1
-{updating} b v0.1.0 (registry [..]) -> v0.1.1
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+[UPDATING] a v0.1.0 (registry [..]) -> v0.1.1
+[UPDATING] b v0.1.0 (registry [..]) -> v0.1.1
+")));
assert_that(p.cargo("update").arg("-pb").arg("-pc"),
execs().with_status(0)
.with_stdout(format!("\
-{updating} registry `[..]`
-{updating} c v0.1.0 (registry [..]) -> v0.1.1
-", updating = UPDATING)));
+[UPDATING] registry `[..]`
+[UPDATING] c v0.1.0 (registry [..]) -> v0.1.1
+")));
assert_that(p.cargo("build"),
execs().with_status(0)
.with_stdout_contains(format!("\
{downloading} c v0.1.1 (registry file://[..])", downloading = DOWNLOADING))
.with_stdout_contains(format!("\
-{compiling} a v0.1.1 (registry [..])", compiling = COMPILING))
+[COMPILING] a v0.1.1 (registry [..])"))
.with_stdout_contains(format!("\
-{compiling} b v0.1.1 (registry [..])", compiling = COMPILING))
+[COMPILING] b v0.1.1 (registry [..])"))
.with_stdout_contains(format!("\
-{compiling} c v0.1.1 (registry [..])", compiling = COMPILING))
+[COMPILING] c v0.1.1 (registry [..])"))
.with_stdout_contains(format!("\
-{compiling} foo v0.5.0 ([..])", compiling = COMPILING)));
+[COMPILING] foo v0.5.0 ([..])")));
});
test!(bundled_crate_in_registry {
assert_that(p.cargo("build"),
execs().with_status(0).with_stdout(&format!("\
-{updating} registry `[..]`
+[UPDATING] registry `[..]`
{downloading} baz v0.1.0 ([..])
-{compiling} baz v0.1.0 ([..])
-{compiling} bar v0.5.0 ([..])
-", downloading = DOWNLOADING, compiling = COMPILING, updating = UPDATING)));
+[COMPILING] baz v0.1.0 ([..])
+[COMPILING] bar v0.5.0 ([..])
+", downloading = DOWNLOADING)));
});
test!(resolve_and_backtracking {
use std::path::MAIN_SEPARATOR as SEP;
use support::{project, execs, path2url};
-use support::{COMPILING, RUNNING, ERROR};
use hamcrest::{assert_that, existing_file};
fn setup() {
assert_that(p.cargo_process("run"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `target{sep}debug{sep}foo[..]`
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `target{sep}debug{sep}foo[..]`
hello
",
- compiling = COMPILING,
- running = RUNNING,
dir = path2url(p.root()),
sep = SEP)));
assert_that(&p.bin("foo"), existing_file());
assert_that(p.cargo_process("run").arg("-q").arg("-v"),
execs().with_status(101).with_stderr(&format!("\
-{error} cannot set both --verbose and --quiet
-",
-error = ERROR)));
+[ERROR] cannot set both --verbose and --quiet
+")));
});
test!(quiet_and_verbose_config {
assert_that(p.cargo_process("run"),
execs().with_status(2)
.with_stderr(&format!("\
-{error} Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-",
-error = ERROR)));
+[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
+")));
});
test!(exit_code_verbose {
assert_that(p.cargo_process("run").arg("-v"),
execs().with_status(2)
.with_stderr(&format!("\
-{error} Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-",
-error = ERROR)));
+[ERROR] Process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
+")));
});
test!(no_main_file {
assert_that(p.cargo_process("run"),
execs().with_status(101)
- .with_stderr(&format!("{error} a bin target must be available \
- for `cargo run`\n", error = ERROR)));
+ .with_stderr(&format!("[ERROR] a bin target must be available \
+ for `cargo run`\n")));
});
test!(too_many_bins {
assert_that(p.cargo_process("run"),
execs().with_status(101)
- .with_stderr(&format!("{error} `cargo run` requires that a project only \
+ .with_stderr(&format!("[ERROR] `cargo run` requires that a project only \
have one executable; use the `--bin` option \
- to specify which one to run\n", error = ERROR)));
+ to specify which one to run\n")));
});
test!(specify_name {
assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `rustc src[..]lib.rs [..]`
-{running} `rustc src[..]a.rs [..]`
-{running} `target{sep}debug{sep}a[..]`
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `rustc src[..]lib.rs [..]`
+[RUNNING] `rustc src[..]a.rs [..]`
+[RUNNING] `target{sep}debug{sep}a[..]`
hello a.rs
",
- compiling = COMPILING,
- running = RUNNING,
dir = path2url(p.root()),
sep = SEP)));
assert_that(p.cargo("run").arg("--bin").arg("b").arg("-v"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} `rustc src[..]b.rs [..]`
-{running} `target{sep}debug{sep}b[..]`
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc src[..]b.rs [..]`
+[RUNNING] `target{sep}debug{sep}b[..]`
hello b.rs
",
- running = RUNNING, compiling = COMPILING,
sep = SEP)));
});
assert_that(p.cargo_process("run").arg("--example").arg("a"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `target{sep}debug{sep}examples{sep}a[..]`
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `target{sep}debug{sep}examples{sep}a[..]`
example
",
- compiling = COMPILING,
- running = RUNNING,
dir = path2url(p.root()),
sep = SEP)));
});
assert_that(p.cargo_process("run").arg("--bin").arg("bin.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no bin target named `bin.rs`", error = ERROR)));
+[ERROR] no bin target named `bin.rs`")));
assert_that(p.cargo_process("run").arg("--bin").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no bin target named `a.rs`
+[ERROR] no bin target named `a.rs`
-Did you mean `a`?", error = ERROR)));
+Did you mean `a`?")));
assert_that(p.cargo_process("run").arg("--example").arg("example.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no example target named `example.rs`", error = ERROR)));
+[ERROR] no example target named `example.rs`")));
assert_that(p.cargo_process("run").arg("--example").arg("a.rs"),
execs().with_status(101).with_stderr(&format!("\
-{error} no example target named `a.rs`
+[ERROR] no example target named `a.rs`
-Did you mean `a`?", error = ERROR)));
+Did you mean `a`?")));
});
test!(either_name_or_example {
assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("--example").arg("b"),
execs().with_status(101)
- .with_stderr(&format!("{error} `cargo run` can run at most one \
+ .with_stderr(&format!("[ERROR] `cargo run` can run at most one \
executable, but multiple were \
- specified",
- error = ERROR)));
+ specified")));
});
test!(one_bin_multiple_examples {
assert_that(p.cargo_process("run"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `target{sep}debug{sep}main[..]`
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `target{sep}debug{sep}main[..]`
hello main.rs
",
- compiling = COMPILING,
- running = RUNNING,
dir = path2url(p.root()),
sep = SEP)));
});
assert_that(p.cargo_process("run").arg("-v").arg("--release").arg("--example").arg("a"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} bar v0.0.1 ({url}/bar)
-{running} `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
+[COMPILING] bar v0.0.1 ({url}/bar)
+[RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
-C opt-level=3 \
-C metadata=[..] \
-C extra-filename=[..] \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}release{sep}deps \
-L dependency={dir}{sep}target{sep}release{sep}deps`
-{compiling} foo v0.0.1 ({url})
-{running} `rustc examples{sep}a.rs --crate-name a --crate-type bin \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc examples{sep}a.rs --crate-name a --crate-type bin \
-C opt-level=3 \
--out-dir {dir}{sep}target{sep}release{sep}examples \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}release \
-L dependency={dir}{sep}target{sep}release{sep}deps \
--extern bar={dir}{sep}target{sep}release{sep}deps{sep}libbar-[..].rlib`
-{running} `target{sep}release{sep}examples{sep}a[..]`
+[RUNNING] `target{sep}release{sep}examples{sep}a[..]`
fast1
fast2
",
- compiling = COMPILING,
- running = RUNNING,
dir = p.root().display(),
url = path2url(p.root()),
sep = SEP)));
assert_that(p.cargo("run").arg("-v").arg("--example").arg("a"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} bar v0.0.1 ({url}/bar)
-{running} `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
+[COMPILING] bar v0.0.1 ({url}/bar)
+[RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
-g \
-C metadata=[..] \
-C extra-filename=[..] \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug{sep}deps \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-{compiling} foo v0.0.1 ({url})
-{running} `rustc examples{sep}a.rs --crate-name a --crate-type bin \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc examples{sep}a.rs --crate-name a --crate-type bin \
-g \
--out-dir {dir}{sep}target{sep}debug{sep}examples \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps \
--extern bar={dir}{sep}target{sep}debug{sep}deps{sep}libbar-[..].rlib`
-{running} `target{sep}debug{sep}examples{sep}a[..]`
+[RUNNING] `target{sep}debug{sep}examples{sep}a[..]`
slow1
slow2
",
- compiling = COMPILING,
- running = RUNNING,
dir = p.root().display(),
url = path2url(p.root()),
sep = SEP)));
assert_that(p.cargo_process("run").arg("--release"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `target{sep}release{sep}foo[..]`
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `target{sep}release{sep}foo[..]`
",
- compiling = COMPILING,
- running = RUNNING,
dir = path2url(p.root()),
sep = SEP)));
assert_that(&p.release_bin("foo"), existing_file());
assert_that(p.cargo("run").cwd(cwd),
execs().with_status(0).with_stdout(&format!("\
-{running} `.{sep}foo[..]`
+[RUNNING] `.{sep}foo[..]`
hello
",
- running = RUNNING,
sep = SEP
)));
});
use std::path::MAIN_SEPARATOR as SEP;
use support::{execs, project};
-use support::{COMPILING, RUNNING, ERROR};
use hamcrest::assert_that;
}
fn cargo_rustc_error() -> String {
- format!("{error} extra arguments to `rustc` can only be passed to one target, \
+ format!("[ERROR] extra arguments to `rustc` can only be passed to one target, \
consider filtering\nthe package by passing e.g. `--lib` or `--bin NAME` to \
- specify a single target", error = ERROR)
+ specify a single target")
}
test!(build_lib_for_foo {
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, compiling = COMPILING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
-Z unstable-options \
--out-dir {dir}{sep}target{sep}debug \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, compiling = COMPILING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())))
});
execs()
.with_status(0)
.with_stdout(&format!("\
-{compiling} {name} v{version} ({url})
-{running} `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \
+[COMPILING] {name} v{version} ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-{running} `rustc src{sep}main.rs --crate-name {name} --crate-type bin -g \
+[RUNNING] `rustc src{sep}main.rs --crate-name {name} --crate-type bin -g \
-Z unstable-options \
--out-dir {dir}{sep}target{sep}debug \
--emit=dep-info,link \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps \
--extern {name}={dir}{sep}target{sep}debug{sep}lib{name}.rlib`
-",
- running = RUNNING, compiling = COMPILING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url(),
name = "foo", version = "0.0.1")));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug [..]`
-{running} `rustc src{sep}bin{sep}bar.rs --crate-name bar --crate-type bin -g \
+[RUNNING] `rustc src{sep}bin{sep}bar.rs --crate-name bar --crate-type bin -g \
-Z unstable-options [..]`
-",
- compiling = COMPILING, running = RUNNING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \
--out-dir {dir}{sep}target{sep}debug [..]`
-{running} `rustc tests{sep}bar.rs --crate-name bar --crate-type bin -g \
+[RUNNING] `rustc tests{sep}bar.rs --crate-name bar --crate-type bin -g \
-Z unstable-options [..]--test[..]`
-",
- compiling = COMPILING, running = RUNNING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} bar v0.1.0 ([..])
-{running} `[..] -g -C [..]`
-{compiling} foo v0.0.1 ({url})
-{running} `[..] -g -Z unstable-options [..]`
+[COMPILING] bar v0.1.0 ([..])
+[RUNNING] `[..] -g -C [..]`
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `[..] -g -Z unstable-options [..]`
",
- compiling = COMPILING, running = RUNNING,
url = foo.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} bar v0.1.0 ([..])
-{running} `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]`
-",
- compiling = COMPILING, running = RUNNING)));
+[COMPILING] bar v0.1.0 ([..])
+[RUNNING] `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]`
+")));
});
test!(fail_with_multiple_packages {
assert_that(foo.cargo("rustc").arg("-v").arg("-p").arg("bar")
.arg("-p").arg("baz"),
execs().with_status(1).with_stderr(format!("\
-{error} Invalid arguments.
+[ERROR] Invalid arguments.
Usage:
- cargo rustc [options] [--] [<opts>...]", error = ERROR)));
+ cargo rustc [options] [--] [<opts>...]")));
});
test!(rustc_with_other_profile {
use std::path::MAIN_SEPARATOR as SEP;
use support::{execs, project};
-use support::{COMPILING, RUNNING, DOCUMENTING, ERROR};
use hamcrest::{assert_that};
fn setup() {
execs()
.with_status(0)
.with_stdout(format!("\
-{documenting} foo v0.0.1 ({url})
-{running} `rustdoc src{sep}lib.rs --crate-name foo \
+[DOCUMENTING] foo v0.0.1 ({url})
+[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \
-o {dir}{sep}target{sep}doc \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, documenting = DOCUMENTING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{documenting} foo v0.0.1 ({url})
-{running} `rustdoc src{sep}lib.rs --crate-name foo \
+[DOCUMENTING] foo v0.0.1 ({url})
+[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \
-o {dir}{sep}target{sep}doc \
--no-defaults \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, documenting = DOCUMENTING, sep = SEP,
+", sep = SEP,
dir = p.root().display(), url = p.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{compiling} bar v0.0.1 ([..])
-{running} `rustc [..]bar{sep}src{sep}lib.rs [..]`
-{documenting} foo v0.0.1 ({url})
-{running} `rustdoc src{sep}lib.rs --crate-name foo \
+[COMPILING] bar v0.0.1 ([..])
+[RUNNING] `rustc [..]bar{sep}src{sep}lib.rs [..]`
+[DOCUMENTING] foo v0.0.1 ({url})
+[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \
-o {dir}{sep}target{sep}doc \
--no-defaults \
-L dependency={dir}{sep}target{sep}debug \
-L dependency={dir}{sep}target{sep}debug{sep}deps \
--extern [..]`
-",
- running = RUNNING, compiling = COMPILING, sep = SEP,
- documenting = DOCUMENTING,
+", sep = SEP,
dir = foo.root().display(), url = foo.url())));
});
execs()
.with_status(0)
.with_stdout(format!("\
-{documenting} bar v0.0.1 ([..])
-{running} `rustdoc [..]bar{sep}src{sep}lib.rs --crate-name bar \
+[DOCUMENTING] bar v0.0.1 ([..])
+[RUNNING] `rustdoc [..]bar{sep}src{sep}lib.rs --crate-name bar \
-o {dir}{sep}target{sep}doc \
--no-defaults \
-L dependency={dir}{sep}target{sep}debug{sep}deps \
-L dependency={dir}{sep}target{sep}debug{sep}deps`
-",
- running = RUNNING, documenting = DOCUMENTING, sep = SEP,
+", sep = SEP,
dir = foo.root().display())));
});
.arg("--").arg("--no-defaults"),
execs()
.with_status(101)
- .with_stderr(&format!("{error} cannot document a package where a library and a \
+ .with_stderr(&format!("[ERROR] cannot document a package where a library and a \
binary have the same name. Consider renaming one \
- or marking the target as `doc = false`",
- error = ERROR)));
+ or marking the target as `doc = false`")));
});
use url::Url;
use cargo::util::ProcessBuilder;
-use support::UPDATING;
use support::execs;
use support::paths;
use support::git::repo;
assert_that(cargo_process("search").arg("postgres"),
execs().with_status(0).with_stdout(format!("\
-{updating} registry `[..]`
-hoare (0.1.1) Design by contract style assertions for Rust", updating = UPDATING)));
+[UPDATING] registry `[..]`
+hoare (0.1.1) Design by contract style assertions for Rust")));
});
test!(multiple_query_params {
assert_that(cargo_process("search").arg("postgres").arg("sql"),
execs().with_status(0).with_stdout(format!("\
-{updating} registry `[..]`
-hoare (0.1.1) Design by contract style assertions for Rust", updating = UPDATING)));
+[UPDATING] registry `[..]`
+hoare (0.1.1) Design by contract style assertions for Rust")));
});
test!(help {
use std::str;
use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
-use support::{COMPILING, RUNNING, DOCTEST, ERROR};
+use support::{DOCTEST};
use support::paths::CargoPathExt;
use hamcrest::{assert_that, existing_file, is_not};
use cargo::util::process;
assert_that(p.cargo("test"),
execs().with_stdout(format!("\
-{} foo v0.5.0 ({})
-{} target[..]foo-[..]
+[COMPILING] foo v0.5.0 ({})
+[RUNNING] target[..]foo-[..]
running 1 test
test test_hello ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-",
- COMPILING, p.url(),
- RUNNING)));
+", p.url())));
});
test!(cargo_test_release {
assert_that(p.cargo_process("test").arg("-v").arg("--release"),
execs().with_stdout(format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{running} [..] -C opt-level=3 [..]
-{compiling} foo v0.1.0 ({dir})
-{running} [..] -C opt-level=3 [..]
-{running} [..] -C opt-level=3 [..]
-{running} [..] -C opt-level=3 [..]
-{running} `[..]target[..]foo-[..]`
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[RUNNING] [..] -C opt-level=3 [..]
+[COMPILING] foo v0.1.0 ({dir})
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] [..] -C opt-level=3 [..]
+[RUNNING] `[..]target[..]foo-[..]`
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} `[..]target[..]test-[..]`
+[RUNNING] `[..]target[..]test-[..]`
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
{doctest} foo
-{running} `rustdoc --test [..]lib.rs[..]`
+[RUNNING] `rustdoc --test [..]lib.rs[..]`
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-",
-compiling = COMPILING, dir = p.url(), running = RUNNING, doctest = DOCTEST)));
+", dir = p.url(), doctest = DOCTEST)));
});
test!(cargo_test_verbose {
assert_that(p.cargo_process("test").arg("-v").arg("hello"),
execs().with_stdout(format!("\
-{compiling} foo v0.5.0 ({url})
-{running} `rustc src[..]foo.rs [..]`
-{running} `[..]target[..]foo-[..] hello`
+[COMPILING] foo v0.5.0 ({url})
+[RUNNING] `rustc src[..]foo.rs [..]`
+[RUNNING] `[..]target[..]foo-[..] hello`
running 1 test
test test_hello ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-",
- compiling = COMPILING, url = p.url(), running = RUNNING)));
+", url = p.url())));
});
test!(many_similar_names {
assert_that(p.cargo("test"),
execs().with_stdout_contains(format!("\
-{compiling} foo v0.5.0 ({url})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.5.0 ({url})
+[RUNNING] target[..]foo-[..]
running 1 test
test test_hello ... FAILED
<tab>thread 'test_hello' panicked at 'assertion failed: \
`(left == right)` (left: \
`\"hello\"`, right: `\"nope\"`)', src[..]foo.rs:12
-", compiling = COMPILING, url = p.url(), running = RUNNING))
+", url = p.url()))
.with_stdout_contains("\
failures:
test_hello
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{} foo v0.0.1 ({})
-{running} target[..]baz-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]baz-[..]
running 1 test
test bin_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]foo[..]
+[RUNNING] target[..]foo[..]
running 1 test
test lib_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- COMPILING, p.url(), running = RUNNING, doctest = DOCTEST)))
+ p.url(), doctest = DOCTEST)))
});
test!(test_with_deep_lib_dep {
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{compiling} bar v0.0.1 ({dir})
-{running} target[..]
+[COMPILING] foo v0.0.1 ([..])
+[COMPILING] bar v0.0.1 ({dir})
+[RUNNING] target[..]
running 1 test
test bar_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
doctest = DOCTEST,
dir = p.url())));
});
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{} foo v0.0.1 ({})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]foo-[..]
running 1 test
test internal_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]test-[..]
+[RUNNING] target[..]test-[..]
running 1 test
test external_test ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- COMPILING, p.url(), running = RUNNING, doctest = DOCTEST)))
+ p.url(), doctest = DOCTEST)))
});
test!(external_test_implicit {
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{} foo v0.0.1 ({})
-{running} target[..]external-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]external-[..]
running 1 test
test external_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]foo-[..]
+[RUNNING] target[..]foo-[..]
running 1 test
test internal_test ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-",
- COMPILING, p.url(), running = RUNNING, doctest = DOCTEST)))
+", p.url(), doctest = DOCTEST)))
});
test!(dont_run_examples {
assert_that(p.cargo_process("test").arg("bar"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]foo-[..]
running 1 test
test bar ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
doctest = DOCTEST,
dir = p.url())));
assert_that(p.cargo("test").arg("foo"),
execs().with_status(0)
.with_stdout(&format!("\
-{running} target[..]foo-[..]
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- running = RUNNING,
doctest = DOCTEST)));
});
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{} foo v0.0.1 ({})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({})
+[RUNNING] target[..]foo-[..]
running 1 test
test [..] ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]foo-[..]
+[RUNNING] target[..]foo-[..]
running 1 test
test [..] ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- COMPILING, p.url(), running = RUNNING, doctest = DOCTEST)))
+ p.url(), doctest = DOCTEST)))
});
test!(lib_with_standard_name {
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
-{running} target[..]syntax-[..]
+[COMPILING] syntax v0.0.1 ({dir})
+[RUNNING] target[..]syntax-[..]
running 1 test
test foo_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]test-[..]
+[RUNNING] target[..]test-[..]
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
doctest = DOCTEST, dir = p.url())));
});
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
-{running} target[..]syntax-[..]
+[COMPILING] syntax v0.0.1 ({dir})
+[RUNNING] target[..]syntax-[..]
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} syntax v0.0.1 ({dir})
-{running} target[..]syntax-[..]
+[COMPILING] syntax v0.0.1 ({dir})
+[RUNNING] target[..]syntax-[..]
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, dir = p.url())));
+", dir = p.url())));
});
test!(bin_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
- binary target bin.name is required",
- error = ERROR)));
+ binary target bin.name is required")));
});
test!(bench_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
- bench target bench.name is required",
- error = ERROR)));
+ bench target bench.name is required")));
});
test!(test_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
- test target test.name is required",
- error = ERROR)));
+ test target test.name is required")));
});
test!(example_without_name {
assert_that(p.cargo_process("test"),
execs().with_status(101)
.with_stderr(&format!("\
-{error} failed to parse manifest at `[..]`
+[ERROR] failed to parse manifest at `[..]`
Caused by:
- example target example.name is required",
- error = ERROR)));
+ example target example.name is required")));
});
test!(bin_there_for_integration {
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} bar v0.0.1 ({dir}/bar)
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo-[..]
+[COMPILING] bar v0.0.1 ({dir}/bar)
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]test-[..]
+[RUNNING] target[..]test-[..]
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
p.root().move_into_the_past().unwrap();
assert_that(p.cargo("test"),
execs().with_status(0)
.with_stdout(format!("\
-{running} target[..]foo-[..]
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]test-[..]
+[RUNNING] target[..]test-[..]
running 1 test
test foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-",
- running = RUNNING)));
+")));
});
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
doctest = DOCTEST,
dir = p.url())));
assert_that(p.cargo("test"),
execs().with_status(0)
.with_stdout(format!("\
-{running} target[..]foo-[..]
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- running = RUNNING,
doctest = DOCTEST)));
});
assert_that(p.cargo_process("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]foo-[..]
running 1 test
test foo ... ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING, running = RUNNING,
doctest = DOCTEST,
dir = p.url())));
assert_that(p.cargo_process("test").arg("--no-run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
+[COMPILING] foo v0.0.1 ({dir})
",
- compiling = COMPILING,
dir = p.url())));
});
.file("src/bin2.rs", "#[test] fn test2() { }");
let expected_stdout = format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]bin2-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]bin2-[..]
running 1 test
test test2 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING,
- running = RUNNING,
dir = prj.url());
assert_that(prj.cargo_process("test").arg("--bin").arg("bin2"),
.file("tests/b.rs", "#[test] fn test_b() { }");
let expected_stdout = format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]b-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]b-[..]
running 1 test
test test_b ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
",
- compiling = COMPILING,
- running = RUNNING,
dir = prj.url());
assert_that(prj.cargo_process("test").arg("--test").arg("b"),
assert_that(p.cargo_process("test").arg("--").arg("--nocapture"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]bar-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]bar-[..]
",
- compiling = COMPILING, running = RUNNING,
dir = p.url())));
});
assert_that(p.cargo("test").arg("-p").arg("d1"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} d1 v0.0.1 ({dir}/d1)
-{running} target[..]d1-[..]
+[COMPILING] d1 v0.0.1 ({dir}/d1)
+[RUNNING] target[..]d1-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]d1-[..]
+[RUNNING] target[..]d1-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING,
+",
dir = p.url())));
println!("d2");
assert_that(p.cargo("test").arg("-p").arg("d2"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} d2 v0.0.1 ({dir}/d2)
-{running} target[..]d2-[..]
+[COMPILING] d2 v0.0.1 ({dir}/d2)
+[RUNNING] target[..]d2-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]d2-[..]
+[RUNNING] target[..]d2-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING,
+",
dir = p.url())));
println!("whole");
assert_that(p.cargo("test"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo-[..]
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] target[..]foo-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING,
+",
dir = p.url())));
});
assert_that(p.cargo("test").arg("-p").arg("d1"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} d1 v0.0.1 ({dir}/d1)
-{running} target[..]deps[..]d1[..]
+[COMPILING] d1 v0.0.1 ({dir}/d1)
+[RUNNING] target[..]deps[..]d1[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, dir = p.url(),
+", dir = p.url(),
doctest = DOCTEST)));
});
assert_that(p.cargo_process("test").arg("--no-run").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
-{running} `rustc [..]`
-{running} `rustc [..]`
-", compiling = COMPILING, running = RUNNING, dir = p.url())));
+[COMPILING] foo v0.0.1 ({dir})
+[RUNNING] `rustc [..]`
+[RUNNING] `rustc [..]`
+", dir = p.url())));
assert_that(&p.bin("foo"), is_not(existing_file()));
assert_that(&p.bin("examples/foo"), existing_file());
assert_that(p.cargo("run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} [..]
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] [..]
bin
-", compiling = COMPILING, running = RUNNING)));
+")));
assert_that(&p.bin("foo"), existing_file());
});
[..]
[..]
[..]
-{running} `rustc [..] --crate-name ex [..] --extern a=[..]`
-", running = RUNNING)));
+[RUNNING] `rustc [..] --crate-name ex [..] --extern a=[..]`
+")));
});
test!(bin_is_preserved {
assert_that(p.cargo_process("run").arg("--example").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} no example target named `foo`
-",
- error = ERROR)));
+[ERROR] no example target named `foo`
+")));
assert_that(p.cargo_process("run").arg("--bin").arg("foo"),
execs().with_status(101).with_stderr(&format!("\
-{error} no bin target named `foo`
-",
- error = ERROR)));
+[ERROR] no bin target named `foo`
+")));
});
test!(doctest_feature {
assert_that(p.cargo_process("test").arg("--features").arg("bar"),
execs().with_status(0).with_stdout(format!("\
-{compiling} foo [..]
-{running} target[..]foo[..]
+[COMPILING] foo [..]
+[RUNNING] target[..]foo[..]
running 0 tests
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)))
+", doctest = DOCTEST)))
});
test!(dashes_to_underscores {
assert_that(p.cargo_process("test").arg("--test=foo"),
execs().with_stdout(format!("\
-{compiling} foo v0.0.1 ([..])
-{running} target[..]debug[..]foo[..]
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] target[..]debug[..]foo[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING)));
+")));
});
test!(dylib_doctest {
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{compiling} foo v0.0.1 ([..])
+[COMPILING] foo v0.0.1 ([..])
{doctest} foo
running 1 test
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, doctest = DOCTEST)));
+", doctest = DOCTEST)));
});
test!(dylib_doctest2 {
"#);
assert_that(p.cargo_process("test"),
execs().with_stdout(format!("\
-{compiling} foo v0.0.1 ([..])
-{compiling} bar v0.0.1 ([..])
-{running} target[..]foo[..]
+[COMPILING] foo v0.0.1 ([..])
+[COMPILING] bar v0.0.1 ([..])
+[RUNNING] target[..]foo[..]
running 0 tests
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)))
+", doctest = DOCTEST)))
});
test!(dev_dep_with_build_script {
assert_that(p.cargo_process("test").arg("--no-fail-fast"),
execs().with_status(101)
.with_stdout_contains(format!("\
-{compiling} foo v0.0.1 ([..])
-{running} target[..]foo[..]
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] target[..]foo[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]test_add_one[..]
-", compiling = COMPILING, running = RUNNING))
+[RUNNING] target[..]test_add_one[..]
+"))
.with_stdout_contains(format!("\
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured
-{running} target[..]test_sub_one[..]
+[RUNNING] target[..]test_sub_one[..]
running 1 test
test sub_one_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", running = RUNNING, doctest = DOCTEST)))
+", doctest = DOCTEST)))
});
test!(test_multiple_packages {
assert_that(p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"),
execs().with_status(0)
.with_stdout_contains(&format!("\
-{running} target[..]debug[..]d1-[..]
+[RUNNING] target[..]debug[..]d1-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", running = RUNNING))
+"))
.with_stdout_contains(&format!("\
-{running} target[..]debug[..]d2-[..]
+[RUNNING] target[..]debug[..]d2-[..]
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", running = RUNNING)));
+")));
});
test!(bin_does_not_rebuild_tests {
assert_that(p.cargo("test").arg("-v").arg("--no-run"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
-{running} `rustc src[..]main.rs [..]`
-{running} `rustc src[..]main.rs [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] foo v0.0.1 ([..])
+[RUNNING] `rustc src[..]main.rs [..]`
+[RUNNING] `rustc src[..]main.rs [..]`
+")));
});
test!(selective_test_wonky_profile {
assert_that(p.cargo("test").arg("-v").arg("--no-run")
.arg("--features").arg("a").arg("-p").arg("a"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} a v0.0.1 ([..])
-{running} `rustc a[..]src[..]lib.rs [..]`
-{running} `rustc a[..]src[..]lib.rs [..]`
-", compiling = COMPILING, running = RUNNING)));
+[COMPILING] a v0.0.1 ([..])
+[RUNNING] `rustc a[..]src[..]lib.rs [..]`
+[RUNNING] `rustc a[..]src[..]lib.rs [..]`
+")));
});
test!(only_test_docs {
use support::{path2url, project, execs};
-use support::{COMPILING, RUNNING};
use hamcrest::assert_that;
fn setup() {
assert_that(foo.cargo_process("build").arg("--verbose"),
execs().with_stdout(&format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
-", compiling = COMPILING, running = RUNNING, url = foo.url())))
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]`
+", url = foo.url())))
});
test!(absolute_tools {
assert_that(foo.cargo_process("build").arg("--verbose"),
execs().with_stdout(&format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc [..] -C ar={ar} -C linker={linker} [..]`
-", compiling = COMPILING, running = RUNNING, url = foo.url(), ar = output.0, linker = output.1)))
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc [..] -C ar={ar} -C linker={linker} [..]`
+", url = foo.url(), ar = output.0, linker = output.1)))
});
test!(relative_tools {
assert_that(origin.cargo_process("build").cwd(foo_path).arg("--verbose"),
execs().with_stdout(&format!("\
-{compiling} foo v0.0.1 ({url})
-{running} `rustc [..] -C ar={ar} -C linker={linker} [..]`
-", compiling = COMPILING, running = RUNNING, url = foo_url, ar = output.0, linker = output.1)))
+[COMPILING] foo v0.0.1 ({url})
+[RUNNING] `rustc [..] -C ar={ar} -C linker={linker} [..]`
+", url = foo_url, ar = output.0, linker = output.1)))
});